Skip to content

Commit

Permalink
Don’t manually pass pagination page default #1887
Browse files Browse the repository at this point in the history
Otherwise the ErrorPageException would get thrown if the pagination does not contain elements and therefore does not have any pages; the default page is now automatically determined if not passed.
  • Loading branch information
lukasbestle committed Sep 29, 2019
1 parent c751187 commit bfaba54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/sections/mixins/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Sets the default page for the pagination. This will overwrite default pagination.
*/
'page' => function (int $page = null) {
return get('page', $page ?? 1);
return get('page', $page);
},
],
'methods' => [
Expand Down
4 changes: 2 additions & 2 deletions src/Cms/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public function __construct(array $params = [])
}

if ($params['method'] === 'query') {
$params['page'] = $params['page'] ?? $params['url']->query()->get($params['variable'], 1);
$params['page'] = $params['page'] ?? $params['url']->query()->get($params['variable']);
} else {
$params['page'] = $params['page'] ?? $params['url']->params()->get($params['variable'], 1);
$params['page'] = $params['page'] ?? $params['url']->params()->get($params['variable']);
}

parent::__construct($params);
Expand Down

0 comments on commit bfaba54

Please sign in to comment.