protected function _getJsonApiPaginationResponse(array $pagination)
    {
        $defaultUrl = array_intersect_key($pagination, [
            'sort' => null,
            'page' => null,
            'limit' => null,
        ], $pagination);

        $request = $this->_request();
        $defaultUrl += [
            'include' => $request->getQuery('include'),
            'fields' => $request->getQuery('fields'),
            'filter' => $request->getQuery('filter'),
        ];

        $fullBase = (bool)$this->_controller()->Crud->getConfig('listeners.jsonApi.absoluteLinks');

        $self = Router::url([
            'controller' => $this->_controller()->getName(),
            'action' => 'index',
            'page' => $pagination['page'],
            '_method' => 'GET',
        ] + $defaultUrl, $fullBase);

        $first = Router::url([
            'controller' => $this->_controller()->getName(),
            'action' => 'index',
            'page' => 1,
            '_method' => 'GET',
        ] + $defaultUrl, $fullBase);

        $last = Router::url([
            'controller' => $this->_controller()->getName(),
            'action' => 'index',
            'page' => $pagination['pageCount'],
            '_method' => 'GET',
        ] + $defaultUrl, $fullBase);

        $prev = null;
        if ($pagination['prevPage']) {
            $prev = Router::url([
                'controller' => $this->_controller()->getName(),
                'action' => 'index',
                'page' => $pagination['page'] - 1,
                '_method' => 'GET',
            ] + $defaultUrl, $fullBase);
        }

        $next = null;
        if ($pagination['nextPage']) {
            $next = Router::url([
                'controller' => $this->_controller()->getName(),
                'action' => 'index',
                'page' => $pagination['page'] + 1,
                '_method' => 'GET',
            ] + $defaultUrl, $fullBase);
        }

        return [
            'self' => $self,
            'first' => $first,
            'last' => $last,
            'prev' => $prev,
            'next' => $next,
            'record_count' => $pagination['count'],
            'page_count' => $pagination['pageCount'],
            'page_limit' => $pagination['limit'],
        ];
    }