protected function addPaginationHeaders($pagination)
    {
        $links = [];
        foreach ($pagination->getLinks(true) as $rel => $url) {
            $links[] = "<$url>; rel=$rel";
        }

        $this->response->setHeader($this->totalCountHeader, $pagination->totalCount);
        $this->response->setHeader($this->pageCountHeader, $pagination->getPageCount());
        $this->response->setHeader($this->currentPageHeader, $pagination->getPage() + 1);
        $this->response->setHeader($this->perPageHeader, $pagination->pageSize);
        $this->response->setHeader('Link', implode(', ', $links));
    }