<commit_before>import React from 'react';
import utils from '../utils';
import {Link} from 'react-router';
import {t} from '../locale';

const Pagination = React.createClass({
  propTypes: {
    pageLinks: React.PropTypes.string.isRequired,
    to: React.PropTypes.string
  },

  contextTypes: {
    location: React.PropTypes.object
  },

  render(){
    if (!this.props.pageLinks) {
      return null;
    }

    let links = utils.parseLinkHeader(this.props.pageLinks);

    let previousPageClassName = 'btn btn-default btn-lg prev';
    if (links.previous.results === false) {
      previousPageClassName += ' disabled';
    }

    let nextPageClassName = 'btn btn-default btn-lg next';
    if (links.next.results === false) {
      nextPageClassName += ' disabled';
    }

    let location = this.context.location;
    return (
      <div className="stream-pagination">
        <div className="btn-group pull-right">
          <Link
            to={this.props.to || location.pathname}
            query={{...location.query, cursor: links.previous.cursor}}
            className={previousPageClassName}
            disabled={links.previous.results === false}>
            <span title={t('Previous')} className="icon-arrow-left"></span>
          </Link>
          <Link to={this.props.to || location.pathname}
            query={{...location.query, cursor: links.next.cursor}}
            className={nextPageClassName}
            disabled={links.next.results === false}>
            <span title={t('Next')} className="icon-arrow-right"></span>
          </Link>
        </div>
      </div>
    );
  }
});

export default Pagination;
<commit_msg>Make pageLinks no longer a required prop (returns null if falsy)<commit_after>import React from 'react';
import utils from '../utils';
import {Link} from 'react-router';
import {t} from '../locale';

const Pagination = React.createClass({
  propTypes: {
    pageLinks: React.PropTypes.string,
    to: React.PropTypes.string
  },

  contextTypes: {
    location: React.PropTypes.object
  },

  render(){
    if (!this.props.pageLinks) {
      return null;
    }

    let links = utils.parseLinkHeader(this.props.pageLinks);

    let previousPageClassName = 'btn btn-default btn-lg prev';
    if (links.previous.results === false) {
      previousPageClassName += ' disabled';
    }

    let nextPageClassName = 'btn btn-default btn-lg next';
    if (links.next.results === false) {
      nextPageClassName += ' disabled';
    }

    let location = this.context.location;
    return (
      <div className="stream-pagination">
        <div className="btn-group pull-right">
          <Link
            to={this.props.to || location.pathname}
            query={{...location.query, cursor: links.previous.cursor}}
            className={previousPageClassName}
            disabled={links.previous.results === false}>
            <span title={t('Previous')} className="icon-arrow-left"></span>
          </Link>
          <Link to={this.props.to || location.pathname}
            query={{...location.query, cursor: links.next.cursor}}
            className={nextPageClassName}
            disabled={links.next.results === false}>
            <span title={t('Next')} className="icon-arrow-right"></span>
          </Link>
        </div>
      </div>
    );
  }
});

export default Pagination;

{'fraction_non_alphanumeric': 0.14778177458033573, 'fraction_numerical': 0.0, 'mean_word_length': 2.55, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '1885264', 'n_tokens_mistral': 944, 'n_tokens_neox': 934, 'n_words': 204}