code: protected function serializePagination($pagination)
      {
          return [
              $this->linksEnvelope => Link::serialize($pagination->getLinks(true)),
              $this->metaEnvelope => [
                  'totalCount' => $pagination->totalCount,
                  'pageCount' => $pagination->getPageCount(),
                  'currentPage' => $pagination->getPage() + 1,
                  'perPage' => $pagination->getPageSize(),
              ],
          ];
      }
docs: Serializes a pagination into an array.
  @param Pagination $pagination
  @return array the array representation of the pagination
  @see addPaginationHeaders()