diff options
author | admin <devnull@localhost> | 2006-10-27 05:11:11 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-10-27 05:11:11 +0200 |
commit | b84f7c03473f271ca53c80f9cb0f4b28755bb2cf (patch) | |
tree | cab4763d0c110e02cb47c0f3a809294980778cac /system/libraries/Pagination.php | |
parent | 3ebc94551c02c32295621fa3b681b207107a7619 (diff) |
Diffstat (limited to 'system/libraries/Pagination.php')
-rw-r--r-- | system/libraries/Pagination.php | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index a004419d6..c66d570cd 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -109,17 +109,6 @@ class CI_Pagination { // Calculate the total number of pages $num_pages = ceil($this->total_rows / $this->per_page); - /* - // Calculate the total number of pages - $num_pages = intval($this->total_rows / $this->per_page); - - // Use modulus to see if our division has a remainder. If so, add one to our page number. - if ($this->total_rows % $this->per_page) - { - $num_pages++; - } - */ - // Is there only one page? Hm... nothing more to do here then. if ($num_pages == 1) { @@ -138,6 +127,13 @@ class CI_Pagination { $this->cur_page = 0; } + // Is the page number beyond the result range? + // If so we show the last page + if ($this->cur_page > $this->total_rows) + { + $this->cur_page = ($num_pages - 1) * $this->per_page; + } + $uri_page_number = $this->cur_page; $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); |