<commit_before>function initializeList() {
    $('body').on('click', '.preview', null, function() {
        var button = this;
        if ($(button).hasClass('open')) {
            $(button).parents('td').find('section').each(function () {
                $(this).slideUp('fast', function () {
                    $(button).removeClass('open');
                });
            });
        } else {
            $(button).parents('td').find('section').each(function () {
                $(this).slideDown('fast', function () {
                    $(button).addClass('open');
                });
            });
        }
    });
    $('#sortings').on('change', '#add-sort', null, function() {
        if ($(this).find(':selected').val()) {
            window.location.href = addQueryStringParameter(document.URL, 'sort[]', $(this).find(':selected').val());
        }
    });
    $('#perpage').change(function () {
        window.location.href = updateQueryStringParameter(document.URL, 'perpage', $(this).find(':selected').val());
    });
    $('.add-bookmark').click(function() {
        addBookmark($(this).parents('tr').attr('data-id'));
        return false;
    });
    $('body').on('click', '.explore-links', null, function() {
        var row = $(this).parents('tr');
        $.ajax({
            url: '/record/' + $(row).attr('data-id') + '/links'
        }).done(function (data) {
            if ($(row).parents('.leftPane').length > 0) {
                $('tr.browsing').removeClass('browsing');
                $('.rightPane').remove();
            } else {
                window.scrollTo(0, 0);
                $('.leftPane').remove();
                $('.rightPane').removeClass('rightPane').addClass('leftPane').css('margin-top', '0');
            }
            $(row).addClass('browsing');
            $('.search-scroller').append('<div class="rightPane" style="margin-top: ' + $(window).scrollTop() + 'px">' + data + '</div>');
        });
    });
}<commit_msg>Use an object for search paging<commit_after>function initializeList() {
    $('body').on('click', '.preview', null, function() {
        var button = this;
        if ($(button).hasClass('open')) {
            $(button).parents('td').find('section').each(function () {
                $(this).slideUp('fast', function () {
                    $(button).removeClass('open');
                });
            });
        } else {
            $(button).parents('td').find('section').each(function () {
                $(this).slideDown('fast', function () {
                    $(button).addClass('open');
                });
            });
        }
    });
    $('#sortings').on('change', '#add-sort', null, function() {
        if ($(this).find(':selected').val()) {
            window.location.href = addQueryStringParameter(document.URL, 'sort[]', $(this).find(':selected').val());
        }
    });
    $('#perpage').change(function () {
        window.location.href = updateQueryStringParameter(document.URL, 'perpage', $(this).find(':selected').val());
    });
    $('.add-bookmark').click(function() {
        addBookmark($(this).parents('tr').attr('data-id'));
        return false;
    });
    $('body').on('click', '.explore-links', null, function() {
        var row = $(this).parents('tr');
        window.bnpanes.next('/record/' + $(row).attr('data-id') + '/links', row);
    });
}

/* The built-in caching from the web browser will almost certainly be sufficient,
   but implementing our own history/garbage collection is useful for tracking
   what the system is doing while we're trying to refactor search panes. */
(function( bnpanes, $, undefined ) {
    var panes = { };
    var current;
    var previous = [ ];
    var next = [ ];
    var history = [ ];
    
    bnpanes.historysize = 4;
    bnpanes.viewportwidth = 2;
    
    bnpanes.previous = function (url, reference) {
        if (url) {
            previous = bnpanes.gc(previous, 0);
        } else {
            url = previous.shift;
        }
        me.load(url);
    };
        
    bnpanes.next = function (url, reference) {
        if (url) {
            next = bnpanes.gc(next, 0);
        } else {
            url = next.shift;
        }
        bnpanes.load(url, function (data) {
            if ($(reference).parents('.leftPane').length > 0) {
                $('tr.browsing').removeClass('browsing');
                $('.rightPane').remove();
            } else {
                window.scrollTo(0, 0);
                $('.leftPane').remove();
                $('.rightPane').removeClass('rightPane').addClass('leftPane').css('margin-top', '0');
            }
            $(reference).addClass('browsing');
            $('.search-scroller').append('<div class="rightPane" style="margin-top: ' + $(window).scrollTop() + 'px">' + data + '</div>');
        });
    };
    
    bnpanes.load = function (url, render) {
        if (panes[url]) {
            render(panes[url]);
        } else {
            $.ajax({
                url: url,
                success: function (data) {
                    panes[url] = data;
                    history.unshift(url);
                    bnpanes.gc();
                    render(data);
                },
                failure: function (data) {
                }
            });
        }
    };
    
    bnpanes.gc = function (list, length) {
        list = list || history;
        length = length || bnpanes.historysize;
        var url;
        while (list.length > length) {
            url = list.pop();
            delete panes[url];
        }
        return list;
    };
}( window.bnpanes = window.bnpanes || {}, jQuery ));
{'fraction_non_alphanumeric': 0.19695089523134196, 'fraction_numerical': 0.002127282396738167, 'mean_word_length': 1.8309081786251882, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, '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': '5065664', 'n_tokens_mistral': 1607, 'n_tokens_neox': 1554, 'n_words': 271}