private function generatePagingLinksHeaders($routeName, Request $request, Response $response)
    {
        $rql = '';
        if ($request->attributes->get('hasRql', false)) {
            $rql = $request->attributes->get('rawRql', '');
        }

        $this->generateLinks(
            $routeName,
            $request->attributes->get('page'),
            $request->attributes->get('numPages'),
            $request->attributes->get('perPage'),
            $request,
            $rql
        );

        $response->headers->set(
            'X-Total-Count',
            (string) $request->attributes->get('totalCount')
        );
    }