<commit_before>/* eslint-disable react/no-array-index-key */
// this is because there isn't necessarily a unique id to use as the key

import React from 'react'
import PropTypes from 'prop-types'

import { GridRow, GridCol } from 'govuk-react'
import Task from '../../../client/components/Task'

import {
  CollectionHeader,
  CollectionSort,
  CollectionItem,
  Pagination,
  RoutedDownloadDataHeader,
} from '../../components'

const CollectionList = ({
  results = [],
  itemsPerPage = 10,
  sortOptions,
  taskProps,
  count = 0,
  isComplete,
  collectionName = 'result',
  items,
  activePage = 1,
  onPageClick,
  maxItemsToDownload,
  baseDownloadLink,
  entityName,
  entityNamePlural,
  addItemUrl,
}) => (
  <GridRow>
    <GridCol setWidth="full">
      <article>
        {isComplete && (
          <CollectionHeader
            totalItems={count}
            collectionName={collectionName}
            addItemUrl={addItemUrl}
            data-test="collection-header"
          />
        )}

        {sortOptions && (
          <CollectionSort sortOptions={sortOptions} totalPages={count} />
        )}
        <RoutedDownloadDataHeader
          count={count}
          maxItems={maxItemsToDownload}
          data-test="download-data-header"
          baseDownloadLink={baseDownloadLink}
          entityName={entityName}
          entityNamePlural={entityNamePlural}
        />
        {items.map(
          (
            { headingText, headingUrl, subheading, badges, metadata, type },
            index
          ) => (
            <CollectionItem
              key={[count, activePage, index].join('-')}
              headingUrl={headingUrl}
              headingText={headingText}
              subheading={subheading}
              badges={badges}
              metadata={metadata}
              type={type}
            />
          )
        )}

        <Task.Status {...taskProps}>
          {() =>
            isComplete && (
              <>
                {results.map((item, i) => (
                  <CollectionItem {...item} key={i} />
                ))}
                <Pagination
                  totalPages={Math.ceil(count / itemsPerPage)}
                  onPageClick={onPageClick}
                  activePage={activePage}
                />
              </>
            )
          }
        </Task.Status>
      </article>
    </GridCol>
  </GridRow>
)
<commit_msg>Fix pagination label in opportunity page<commit_after>/* eslint-disable react/no-array-index-key */
// this is because there isn't necessarily a unique id to use as the key

import React from 'react'
import PropTypes from 'prop-types'

import { GridRow, GridCol } from 'govuk-react'
import Task from '../../../client/components/Task'

import {
  CollectionHeader,
  CollectionSort,
  CollectionItem,
  Pagination,
  RoutedDownloadDataHeader,
} from '../../components'

const CollectionList = ({
  results = [],
  itemsPerPage = 10,
  sortOptions,
  taskProps,
  count = 0,
  isComplete,
  collectionName = 'result',
  items,
  activePage = 1,
  onPageClick,
  maxItemsToDownload,
  baseDownloadLink,
  entityName,
  entityNamePlural,
  addItemUrl,
}) => {
  const totalPages = Math.ceil(count / itemsPerPage)
  return (
    <GridRow>
      <GridCol setWidth="full">
        <article>
          {isComplete && (
            <CollectionHeader
              totalItems={count}
              collectionName={collectionName}
              addItemUrl={addItemUrl}
              data-test="collection-header"
            />
          )}

          {sortOptions && (
            <CollectionSort sortOptions={sortOptions} totalPages={totalPages} />
          )}
          <RoutedDownloadDataHeader
            count={count}
            maxItems={maxItemsToDownload}
            data-test="download-data-header"
            baseDownloadLink={baseDownloadLink}
            entityName={entityName}
            entityNamePlural={entityNamePlural}
          />
          {items.map(
            (
              { headingText, headingUrl, subheading, badges, metadata, type },
              index
            ) => (
              <CollectionItem
                key={[count, activePage, index].join('-')}
                headingUrl={headingUrl}
                headingText={headingText}
                subheading={subheading}
                badges={badges}
                metadata={metadata}
                type={type}
              />
            )
          )}

          <Task.Status {...taskProps}>
            {() =>
              isComplete && (
                <>
                  {results.map((item, i) => (
                    <CollectionItem {...item} key={i} />
                  ))}
                  <Pagination
                    totalPages={Math.ceil(count / itemsPerPage)}
                    onPageClick={onPageClick}
                    activePage={activePage}
                  />
                </>
              )
            }
          </Task.Status>
        </article>
      </GridCol>
    </GridRow>
  )
}

{'fraction_non_alphanumeric': 0.11506359300476948, 'fraction_numerical': 0.001589825119236884, 'mean_word_length': 1.6010335917312661, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1781384', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1320, 'n_words': 248}