<commit_before>import Ember from 'ember';
const computed = Ember.computed;
const observer = Ember.observer;

export default Ember.Mixin.create( {
    current_page: null,
    page: 1,
    per_page: 20,
    queryParams: [ 'page', 'per_page' ],
    loadingRecords: false,

    hasMorePages: computed( 'total_pages', 'current_page', function(){
        return this.get( 'current_page' ) < this.get( 'total_pages' );
    } ),

    actions: {
        next: function( modelName, params ){
            var _this = this;
            var currentPage = _this.get( 'current_page' );
            var page = _this.get( 'page' );
            var perPage = _this.get( 'per_page' );
            var model = _this.get( 'model' );

            if( this.get( 'hasMorePages' ) ){
                if( currentPage === null ){
                    _this.set( 'current_page', page + 1 );
                    currentPage = _this.get( 'current_page' );
                }
                else{
                    currentPage = _this.incrementProperty( 'current_page' );<commit_msg>fallback for no total pages being sent<commit_after>import Ember from 'ember';
const computed = Ember.computed;
const observer = Ember.observer;

export default Ember.Mixin.create( {
    current_page: null,
    page: 1,
    per_page: 20,
    queryParams: [ 'page', 'per_page' ],
    loadingRecords: false,

    hasMorePages: computed( 'total_pages', 'current_page', function(){
        var totalPages = this.get( 'total_pages' );
        return !Ember.isEmpty( totalPages ) && this.get( 'current_page' ) < totalPages;
    } ),

    actions: {
        next: function( modelName, params ){
            var _this = this;
            var currentPage = _this.get( 'current_page' );
            var page = _this.get( 'page' );
            var perPage = _this.get( 'per_page' );
            var model = _this.get( 'model' );

            if( this.get( 'hasMorePages' ) ){
                if( currentPage === null ){
                    _this.set( 'current_page', page + 1 );
                    currentPage = _this.get( 'current_page' );
                }
                else{
                    currentPage = _this.incrementProperty( 'current_page' );
{'fraction_non_alphanumeric': 0.12545454545454546, 'fraction_numerical': 0.0036363636363636364, 'mean_word_length': 2.0233516483516483, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4097024', 'n_tokens_mistral': 667, 'n_tokens_neox': 638, 'n_words': 161}