protected function getPaginated(int $sizeOfList) : array { $page = (int) ($_POST['page'] ?? 1); if (($page - 1) * $this->perPage > $sizeOfList) { $page = 1; } if ($page < 1) { $page = 1; } return [(int) $page, (int) ($page - 1) * $this->perPage]; }