<commit_before>var React = require('react');
var Event = require('./Event.jsx');

module.exports = React.createClass({
    getInitialState: function() {
        return ({
            listings: 5,
            startIndex: 0
        })
    },

    componentDidMount: function() {
        $("#previousPage").addClass("disabled");
    },

    previous: function() {
        var previous = $("#previousPage"),
            next = $("#nextPage"),
            startIndex = this.state.startIndex,
            listings = this.state.listings;

        startIndex -= listings;
        if (startIndex < 0) { startIndex = 0; }
        this.setState({ startIndex: startIndex })

        next.removeClass("disabled")
        if (startIndex === 0) {
            previous.addClass("disabled");
        } else {
            next.removeClass("disabled");
        }
    },

    next: function() {
        var previous = $("#previousPage"),
            next = $("#nextPage"),
            startIndex = this.state.startIndex,
            listings = this.state.listings;

        startIndex += listings;
        this.setState({ startIndex: startIndex })

        previous.removeClass("disabled")
        if (startIndex + listings >= this.props.events.length) {
            next.addClass("disabled");
        } else {
            next.removeClass("disabled");
        }
    },

    render: function() {
        var incomingListings = this.props.events,
            incomingLength = incomingListings.length,
            startIndex = this.state.startIndex,
            endIndex = startIndex + this.state.listings;

        var events = incomingListings.slice(startIndex, endIndex);

        var eventList = [];
        events.map(function (event, index) {
            eventList.push(<Event info = { event } key = { "event" + index } />)
        });
        return (
            <div className = 'list'>
                { eventList }
                {
                    incomingLength > this.state.listings ?
                    <nav>
                      <ul className="pager">
                        <li className = "disabled" id = "previousPage"><a onClick = { this.previous }>Previous</a></li>
                        <li id = "nextPage"><a onClick = { this.next }>Next</a></li><commit_msg>change page works for eventList<commit_after>var React = require('react');
var Event = require('./Event.jsx');

module.exports = React.createClass({
    getInitialState: function() {
        return ({
            listings: 5,
            startIndex: 0
        })
    },

    componentDidMount: function() {
        $("#previousPage").addClass("disabled");
    },

    previous: function() {
        var previous = $("#previousPage"),
            next = $("#nextPage"),
            startIndex = this.state.startIndex,
            listings = this.state.listings;

        startIndex -= listings;
        if (startIndex < 0) { startIndex = 0; }
        this.setState({ startIndex: startIndex })

        next.removeClass("disabled")
        if (startIndex === 0) {
            previous.addClass("disabled");
        } else {
            next.removeClass("disabled");
        }
    },

    next: function() {
        var previous = $("#previousPage"),
            next = $("#nextPage"),
            startIndex = this.state.startIndex,
            listings = this.state.listings;

        startIndex += listings;
        this.setState({ startIndex: startIndex })

        previous.removeClass("disabled")
        if (startIndex + listings >= this.props.events.length) {
            next.addClass("disabled");
        } else {
            next.removeClass("disabled");
        }
    },

    render: function() {
        var incomingListings = this.props.events,
            incomingLength = incomingListings.length,
            startIndex = this.state.startIndex,
            endIndex = startIndex + this.state.listings;

        var events = incomingListings.slice(startIndex, endIndex);

        var eventList = [];
        events.map(function (event, index) {
            eventList.push(<Event info = { event } key = { "event" + index } />)
        });
        return (
            <div className = 'list'>
                { eventList }
                {
                    incomingLength > this.state.listings ?
                    <nav>
                      <ul className="pager">
                        <li className = "disabled" id = "previousPage"><a onClick = { this.previous }>Previous</a></li>
                        1 of 3
                        <li id = "nextPage"><a onClick = { this.next }>Next</a></li>
{'fraction_non_alphanumeric': 0.13304252998909488, 'fraction_numerical': 0.0026172300981461287, 'mean_word_length': 1.733015494636472, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, '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': '6617707', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1155, 'n_words': 248}