<commit_before>$(document).ready(function () {
    let keysContainer = $('#keys');
    let keySelectForm = keysContainer.find('#key-select-form');
    let databaseSelect = keysContainer.find('#database-select');
    let limitSelect = keysContainer.find('#limit-select');
    let ajaxSpinner = $('#ajaxSpinner');
    let body = $('body');
    let skipPushState = false;
    keySelectForm.submit(function (e) {
        let formData = $(this).serialize();
        let formUrl = $(this).attr('action');
        ajaxSpinner.show();
        $('#keyValues').load(formUrl + '?' + formData, function () {
            ajaxSpinner.hide();
            $('#searchPattern').focus();
        });
        e.preventDefault();
    });

    databaseSelect.find('a').click(function () {
        let database = $(this).data('database');
        let searchRegExp = new RegExp(/\/database\/\d+\//);
        let newAction = keySelectForm.attr('action').replace(searchRegExp, '/database/' + database + '/');
        keySelectForm.attr('action', newAction);
        keysContainer.find('#current-db').html($(this).html());
        keySelectForm.submit();
        skipPushState || window.history.pushState(null, null, newAction.substr(-5));
        skipPushState = false;
    });

    $(window).on('popstate', function () {
        let testDb = window.location.href.match(/\/database\/(\d+)/), db = testDb ? testDb[1] : 0;
        skipPushState = true;
        databaseSelect.find('[data-database="' + db + '"]').click();
    });

    limitSelect.find('a').click(function () {
        let limit = $(this).data('limit');
        keySelectForm.find('input[name="limit"]').val(limit);
        keysContainer.find('#current-limit').html($(this).html());
        keySelectForm.submit();
    });

    $('[data-toggle="tooltip"]').tooltip();

    body.on('hidden.bs.modal', '.modal', function () {
        $(this).removeData('bs.modal');
    });

    body.on('click', '[data-toggle="modal"]', function () {<commit_msg>Fix substring of new URL for history push state, #12<commit_after>$(document).ready(function () {
    let keysContainer = $('#keys');
    let keySelectForm = keysContainer.find('#key-select-form');
    let databaseSelect = keysContainer.find('#database-select');
    let limitSelect = keysContainer.find('#limit-select');
    let ajaxSpinner = $('#ajaxSpinner');
    let body = $('body');
    let skipPushState = false;
    keySelectForm.submit(function (e) {
        let formData = $(this).serialize();
        let formUrl = $(this).attr('action');
        ajaxSpinner.show();
        $('#keyValues').load(formUrl + '?' + formData, function () {
            ajaxSpinner.hide();
            $('#searchPattern').focus();
        });
        e.preventDefault();
    });

    databaseSelect.find('a').click(function () {
        let database = $(this).data('database');
        let searchRegExp = new RegExp(/\/database\/\d+\//);
        let newAction = keySelectForm.attr('action').replace(searchRegExp, '/database/' + database + '/');
        keySelectForm.attr('action', newAction);
        keysContainer.find('#current-db').html($(this).html());
        skipPushState || window.history.pushState(null, null, newAction.substr(0, newAction.length - 5));
        skipPushState = false;
        keySelectForm.submit();
    });

    $(window).on('popstate', function () {
        let testDb = window.location.href.match(/\/database\/(\d+)/), db = testDb ? testDb[1] : 0;
        skipPushState = true;
        databaseSelect.find('[data-database="' + db + '"]').click();
    });

    limitSelect.find('a').click(function () {
        let limit = $(this).data('limit');
        keySelectForm.find('input[name="limit"]').val(limit);
        keysContainer.find('#current-limit').html($(this).html());
        keySelectForm.submit();
    });

    $('[data-toggle="tooltip"]').tooltip();

    body.on('hidden.bs.modal', '.modal', function () {
        $(this).removeData('bs.modal');
    });

    body.on('click', '[data-toggle="modal"]', function () {
{'fraction_non_alphanumeric': 0.20328031809145128, 'fraction_numerical': 0.0022365805168986083, 'mean_word_length': 3.0009940357852884, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4778207', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1151, 'n_words': 189}