Skip to content

Commit 982aa04

Browse files
BastiLusebastianstein
authored andcommitted
[BUGFIX] Always default currentPage to 1
Sometimes currentPage might be an empty value like 0 or null. We don't want an exception to be triggered in this case. Resolves: #39
1 parent a07cdce commit 982aa04

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Classes/Controller/StudyCourseController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ public function filterAction(array $searchOptions = [], array $pluginInformation
7777
$this->filterService->resolveFilterPropertyPath($searchOptions)
7878
);
7979

80-
$currentPage = $this->request->hasArgument('currentPage')
81-
? (int)$this->request->getArgument('currentPage')
82-
: 1;
80+
$currentPage = 1;
81+
if ($this->request->hasArgument('currentPage')) {
82+
$currentPage = max((int)$this->request->getArgument('currentPage'), 1);
83+
}
8384

8485
$itemsPerPage = (int)($this->settings['pagination']['itemsPerPage'] ?? 10);
8586
$maximumLinks = (int)($this->settings['pagination']['maximumNumberOfLinks'] ?? 15);

0 commit comments

Comments
 (0)