code: protected function sendItems(Response $response, iterable $items, ?Pagination $pagination = null, ?int $total = null): Response
      {
          $items = is_array($items) ? $items : ($items instanceof \Traversable ? iterator_to_array($items, false) : []);
          $total = $total ?? count($items);
          $start = $pagination === null ? 0 : $pagination->getOffset();
          $max = $pagination === null ? 0 : $pagination->getMax();
          // make sure $end is no higher than $total and isn't negative
          $end = max(min((PHP_INT_MAX - $max < $start ? PHP_INT_MAX : $start + $max), $total) - 1, 0);
          return $this->sendJson(
              $response->withHeader('Content-Range', "items $start-$end/$total"),
              $items
          );
      }
docs: Sends a Content-Range header for pagination.
  
  @param \Psr\Http\Message\ResponseInterface $response  The response
  @param iterable $items  The items to serialize
  @param \Caridea\Http\Pagination|null $pagination  The pagination object
  @param int|null $total  The total number of records, if `$items` is a subset
  @return \Psr\Http\Message\ResponseInterface  The JSON response