diff --git a/CHANGELOG.md b/CHANGELOG.md index 105df5a4e..923977c83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Fixed filesystem iterator calls with non-existing folders * Fixed `checkbox` field not being saved, requires also Form v4.0.2 [#1225](https://github.com/getgrav/grav/issues/1225) * Fixed `validation: strict` not working in blueprints [#1273](https://github.com/getgrav/grav/issues/1273) + * Fixed fatal error with non-integer page param value [#2803](https://github.com/getgrav/grav/issues/2803) # v1.6.19 ## 12/04/2019 diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index a138a04bd..16ba4f97e 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -2828,7 +2828,7 @@ class Page implements PageInterface if ($pagination) { $params = $collection->params(); - $limit = $params['limit'] ?? 0; + $limit = (int)($params['limit'] ?? 0); $start = !empty($params['pagination']) ? ($uri->currentPage() - 1) * $limit : 0; if ($limit && $collection->count() > $limit) { diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 33c853d05..f875ab3de 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -541,7 +541,9 @@ class Uri */ public function currentPage() { - return $this->params['page'] ?? 1; + $page = (int)($this->params['page'] ?? 1); + + return max(1, $page); } /**