<commit_before>import * as React from 'react'

export var Pager = React.createClass({
    getDefaultProps() {
        return{
            'maxPage': 0,
            'nextText': '',
            'previousText': '',
            'currentPage': 0,
        }
    },
    pageChange(event) {
        this.props.setPage(parseInt(event.target.getAttribute('data-value')))
    },
    render() {

      var prevActive = this.props.currentPage > 0 ? '': 'disabled'
      var previous = <li className={prevActive}><a onClick={this.props.previous}><i className="glyphicon glyphicon-arrow-left"></i> {this.props.previousText}</a></li>

      var nextActive = this.props.currentPage != (this.props.maxPage -1) ? '': 'disabled'
      var next = <li className={nextActive}><a onClick={this.props.next}>{this.props.nextText} <i className="glyphicon glyphicon-arrow-right"></i></a></li>

      var options = []

      var startIndex = Math.max(this.props.currentPage - 5, 0)
      var endIndex = Math.min(startIndex + 11, this.props.maxPage)

      if (this.props.maxPage >= 11 && (endIndex - startIndex) <= 10) {
        startIndex = endIndex - 11
      }

        for(var i = startIndex; i < endIndex;  i++) {
          var selected = this.props.currentPage == i ? 'active' : ''
            options.push(<li key={i} className={selected}><a onClick={this.pageChange} data-value={i}>{i + 1}</a></li>)
        }

        return (
          <div className="row">
            <div className="col-md-12">
              <ul className="pagination noselect">
                {previous}{options}{next}
              </ul>
            </div>
          </div>
        )
    }
})<commit_msg>First and last pagination options<commit_after>import * as React from 'react'

export var Pager = React.createClass({
    getDefaultProps() {
        return{
            'maxPage': 0,
            'nextText': '',
            'previousText': '',
            'currentPage': 0,
        }
    },
    pageChange(event) {
        this.props.setPage(parseInt(event.target.getAttribute('data-value')))
    },
    render() {

      var prevActive = this.props.currentPage > 0 ? '': 'disabled'
      var previous = <li className={prevActive}><a onClick={this.props.previous}><i className="glyphicon glyphicon-arrow-left"></i> {this.props.previousText}</a></li>

      var nextActive = this.props.currentPage != (this.props.maxPage -1) ? '': 'disabled'
      var next = <li className={nextActive}><a onClick={this.props.next}>{this.props.nextText} <i className="glyphicon glyphicon-arrow-right"></i></a></li>

      var options = []

      var startIndex = Math.max(this.props.currentPage - 5, 0)
      var endIndex = Math.min(startIndex + 11, this.props.maxPage)

      if (this.props.maxPage >= 11 && (endIndex - startIndex) <= 10) {
        startIndex = endIndex - 11
      }

      var firstActive = startIndex > 0 ? '': 'disabled'
      var first = <li className={firstActive}><a onClick={this.pageChange} data-value='0'><i className="glyphicon glyphicon-step-backward"></i>First</a></li>

      var lastActive = endIndex < this.props.maxPage ? '' : 'disabled'
      var last = <li className={lastActive}><a onClick={this.pageChange} data-value={this.props.maxPage - 1}>Last <i className="glyphicon glyphicon-step-forward"></i></a></li>


        for(var i = startIndex; i < endIndex;  i++) {
          var selected = this.props.currentPage == i ? 'active' : ''
            options.push(<li key={i} className={selected}><a onClick={this.pageChange} data-value={i}>{i + 1}</a></li>)
        }

        return (
          <div className="row">
            <div className="col-md-11">
              <ul className="pagination noselect">
                {first}{previous}{options}{next}{last}
              </ul>
            </div>
          </div>
        )
    }
})
{'fraction_non_alphanumeric': 0.16706005769735116, 'fraction_numerical': 0.00970364542355101, 'mean_word_length': 2.45158371040724, 'pattern_counts': {'":': 0, '<': 64, '<?xml version=': 0, '>': 64, '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': '5821069', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1137, 'n_words': 226}