code: protected function paginate(array $rates, $criteria)
      {
          if (!array_key_exists('offset', $criteria) && !array_key_exists('limit', $criteria)) {
              return $rates;
          }
  
          $range = array();
          $offset = array_key_exists('offset', $criteria) ? $criteria['offset'] : 0;
          $limit = min((array_key_exists('limit', $criteria) ? $criteria['limit'] : count($rates)) + $offset, count($rates));
  
          for ($i = $offset; $i < $limit; $i++) {
              $range[] = $rates[$i];
          }
  
          return $range;
      }
docs: Extract requested page from filter criteria.
  
  @param array $rates Rates to filter for pagination.
  @param array $criteria Filter criteria.
  @return RateInterface[] Paginated rates.