Current page not highlighted when uri parameter = total rows |
|||
|---|---|---|---|
| Date: | 06/15/2009 | Severity: | Minor |
| Status: | New | Reporter: | girv |
| Version: | 1.7.1 | ||
| Keywords: | Libraries, Pagination Class | ||
Description
When the page number supplied in the URI segment or query string is exactly equal to the total_rows parameter, the link generated for the last page is a normal pagination link. I believe it should be a “current page” link.
Code Sample
Browse to: http://www.girv.net/contact/10
Normal links are displayed to pages 1 and 2.
(there are 10 contact records, 5 per page)
Browse to: http://www.girv.net/contact/11
A normal link is displayed for 1 page; page 2 is highlighted as the current page.
Pagination initialised as:
$CI->pagination->initialize(array(
'base_url' => '/contact',
'total_rows' => 10,
'per_page' => 5,
'uri_segment' => 2,
'num_links' => 10,
...
));
FWIW, changing line 157 in Pagination.php from
if ($this->cur_page > $this->total_rows)
...to...
if ($this->cur_page >= $this->total_rows)
...fixes the problem.
Expected Result
Link to the last page is displayed as a “current page” link.
Actual Result
Link to the last page is displayed as a normal pagination link.
