Skip to content

Commit

Permalink
Prevent 404 when requesting an out of range page
Browse files Browse the repository at this point in the history
This will allow PagerFanta to normalize the requested page if for whatever reason the page no longer exists in the admin list, for example after a bulk delete action on the last page.
  • Loading branch information
bobvandevijver authored and tobias-93 committed Aug 9, 2023
1 parent 90702bf commit e04ce35
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
protected function getPager()
{
$paginator = new Pagerfanta(new PagerAdapter($this->getQuery()));
$paginator->setNormalizeOutOfRangePages(true);
$paginator->setMaxPerPage($this->getPerPage());
$paginator->setCurrentPage($this->getPage(), false, true);

Expand Down

0 comments on commit e04ce35

Please # to comment.