Changeset 413
- Timestamp:
- 08/26/07 15:36:11 (12 months ago)
- Files:
-
- 1 modified
-
branches/devel/system/libraries/Pagination.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel/system/libraries/Pagination.php
r407 r413 63 63 $this->total_pages = (int) ceil($this->total_items / $this->items_per_page); 64 64 $this->current_page = (int) min(max(1, Kohana::instance()->uri->segment($this->uri_segment)), max(1, $this->total_pages)); 65 $this->current_first_item = (int) (($this->current_page - 1) * $this->items_per_page) + 1;65 $this->current_first_item = (int) min((($this->current_page - 1) * $this->items_per_page) + 1, $this->total_items); 66 66 $this->current_last_item = (int) min($this->current_first_item + $this->items_per_page - 1, $this->total_items); 67 67 … … 70 70 // - previous_page/next_page FALSE if that page doesn't exist relative to the current page 71 71 $this->first_page = ($this->current_page == 1) ? FALSE : 1; 72 $this->last_page = ($this->current_page == $this->total_pages) ? FALSE : $this->total_pages;72 $this->last_page = ($this->current_page >= $this->total_pages) ? FALSE : $this->total_pages; 73 73 $this->previous_page = ($this->current_page > 1) ? $this->current_page - 1 : FALSE; 74 74 $this->next_page = ($this->current_page < $this->total_pages) ? $this->current_page + 1 : FALSE; … … 87 87 public function create_links($style = NULL) 88 88 { 89 $style = (isset($style)) ? $ this->style : $style;89 $style = (isset($style)) ? $style : $this->style; 90 90 91 91 return (string) new View('views/pagination/'.$style, get_object_vars($this));
