<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

import { P } from 'common/base';
import { ArrowLeft } from 'common/icons';

import {
  getFromCount,
  getToCount,
  isPreviousDisabled,
  isNextDisabled,
  getTotalPage,
  getCurrentCount,
} from './helpers';

import styles from './Pagination.module.css';

const Pagination = ({
  totalCount,
  unit,
  currentPage,
  createPageLinkTo,
}) => {
  const totalPage = getTotalPage(totalCount, unit);
  const currentCount = getCurrentCount(totalCount, unit, currentPage);

  if (totalCount === 0) return null;
  return (
    <div className={styles.pagination}>
      <P size="m" className={styles.info}>
        {`${getFromCount(currentPage, unit)}-${getToCount(currentPage, unit, currentCount)} 篇 (共 ${totalCount} 篇)`}
      </P>
      <div>
        <Link
          className="buttonFirstPage"
          to={createPageLinkTo(1)}
        >
          第一頁
        </Link>
        <Link
          className="buttonPage"
          disabled={isPreviousDisabled(currentPage)}
          to={isPreviousDisabled(currentPage) ? undefined : createPageLinkTo(currentPage - 1)}
        >
          <ArrowLeft />前一頁
        </Link>
        <Link
          className="buttonPage"
          disabled={isNextDisabled(currentPage, totalPage)}
          to={isNextDisabled(currentPage, totalPage) ? undefined : createPageLinkTo(currentPage + 1)}
        >
          下一頁<ArrowLeft style={{ transform: 'scaleX(-1)' }} />
        </Link>
      </div>
    </div>
  );
};
<commit_msg>修正 pagination, `to` is required<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

import { P } from 'common/base';
import { ArrowLeft } from 'common/icons';

import {
  getFromCount,
  getToCount,
  isPreviousDisabled,
  isNextDisabled,
  getTotalPage,
  getCurrentCount,
} from './helpers';

import styles from './Pagination.module.css';

const Pagination = ({
  totalCount,
  unit,
  currentPage,
  createPageLinkTo,
}) => {
  const totalPage = getTotalPage(totalCount, unit);
  const currentCount = getCurrentCount(totalCount, unit, currentPage);

  if (totalCount === 0) return null;
  return (
    <div className={styles.pagination}>
      <P size="m" className={styles.info}>
        {`${getFromCount(currentPage, unit)}-${getToCount(currentPage, unit, currentCount)} 篇 (共 ${totalCount} 篇)`}
      </P>
      <div>
        <Link
          className="buttonFirstPage"
          to={createPageLinkTo(1)}
        >
          第一頁
        </Link>
        {
          isPreviousDisabled(currentPage) ?
          (
            <div className="buttonPage" disabled>
              <ArrowLeft />前一頁
            </div>
          )
          : (
            <Link
              className="buttonPage"
              disabled={isPreviousDisabled(currentPage)}
              to={isPreviousDisabled(currentPage) ? '' : createPageLinkTo(currentPage - 1)}
            >
              <ArrowLeft />前一頁
            </Link>
          )
        }
        {
          isNextDisabled(currentPage, totalPage) ?
          (
            <div className="buttonPage" disabled>
              下一頁<ArrowLeft style={{ transform: 'scaleX(-1)' }} />
            </div>
          ) : (
            <Link
              className="buttonPage"
              disabled={isNextDisabled(currentPage, totalPage)}
              to={createPageLinkTo(currentPage + 1)}
            >
              下一頁<ArrowLeft style={{ transform: 'scaleX(-1)' }} />
            </Link>
          )
        }
      </div>
    </div>
  );
};

{'fraction_non_alphanumeric': 0.130686517783292, 'fraction_numerical': 0.0030328094844223876, 'mean_word_length': 2.25089605734767, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5828317', 'n_tokens_mistral': 1079, 'n_tokens_neox': 1092, 'n_words': 217}