diff --git a/wcfsetup/install/files/lib/system/gridView/AbstractGridView.class.php b/wcfsetup/install/files/lib/system/gridView/AbstractGridView.class.php index 66a6de017c4..df686c1bbdc 100644 --- a/wcfsetup/install/files/lib/system/gridView/AbstractGridView.class.php +++ b/wcfsetup/install/files/lib/system/gridView/AbstractGridView.class.php @@ -768,6 +768,10 @@ protected function validate(): void if ($titleColumn === null) { throw new \InvalidArgumentException("Missing title column in grid view with id '{$this->getID()}'."); } + + if ($this->getPageNo() > 1 && $this->getPageNo() > $this->countPages()) { + $this->setPageNo($this->countPages() ?: 1); + } } /** diff --git a/wcfsetup/install/files/lib/system/listView/AbstractListView.class.php b/wcfsetup/install/files/lib/system/listView/AbstractListView.class.php index 9b281b2303b..8f941e89e6e 100644 --- a/wcfsetup/install/files/lib/system/listView/AbstractListView.class.php +++ b/wcfsetup/install/files/lib/system/listView/AbstractListView.class.php @@ -276,6 +276,10 @@ protected function validate(): void } } } + + if ($this->getPageNo() > 1 && $this->getPageNo() > $this->countPages()) { + $this->setPageNo($this->countPages() ?: 1); + } } protected function getSqlOrderBy(): string