private function getCurrentPage($pageParameter)
    {
        if (null === $this->requestStack->getCurrentRequest()) {
            return 1;
        }

        $page = $this->requestStack->getCurrentRequest()->get($pageParameter, 1);
        if ($page < 1 || $page > PHP_INT_MAX) {
            throw new PageOutOfBoundsException($page);
        }

        return $page;
    }