protected function resolveCurrentPage(): int
    {
        $query = $this->request->getQueryParams();

        if (\array_key_exists($this->pageName, $query)) {
            $query = $this->secureInput($query);
            $page  = $query[$this->pageName];

            if ((int) $page >= 1 && \filter_var($page, \FILTER_VALIDATE_INT) !== false) {
                return (int) $page;
            }
        }

        return 1;
    }