Skip to content

Commit

Permalink
Merge pull request #3209 from michalsn/pager_cast_segment_value
Browse files Browse the repository at this point in the history
Cast currentPage value to integer in Pager class
  • Loading branch information
michalsn authored Jul 4, 2020
2 parents 616f5fe + d8ca711 commit dbdafec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion system/Pager/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ protected function calculateCurrentPage(string $group)
{
try
{
$this->groups[$group]['currentPage'] = $this->groups[$group]['uri']->getSegment($this->segment[$group]);
$this->groups[$group]['currentPage'] = (int) $this->groups[$group]['uri']->setSilent(false)->getSegment($this->segment[$group]);
}
catch (\CodeIgniter\HTTP\Exceptions\HTTPException $e)
{
Expand Down
6 changes: 6 additions & 0 deletions tests/system/Pager/PagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ public function testMakeLinks()
$this->assertStringContainsString(
'?page_custom=1', $this->pager->makeLinks(1, null, 1, 'default_full', 0, 'custom')
);
$this->assertStringContainsString(
'/1', $this->pager->makeLinks(1, 10, 1, 'default_full', 1)
);
$this->assertStringContainsString(
'<li class="active">', $this->pager->makeLinks(1, 10, 1, 'default_full', 1)
);
}

public function testHeadLinks()
Expand Down

0 comments on commit dbdafec

Please sign in to comment.