<commit_before>var RESULTS_LOCATION = "flypaper_results.json";

$(document).ready(function() {
    prepare_ui();
    get_json_via_ajax(RESULTS_LOCATION, update_ui);
});

function prepare_ui() {
    $("table#results").tablesorter();
}

function get_json_via_ajax(filename, callback) {
    $.ajax({
        type: "GET",
        url: filename,
        dataType: "json",
        success: function(data) {
            callback(data);
        }
    });
}

function update_ui(results) {
    var rows = "";
    for (var i in results.files) {
        var file = results.files[i];
        rows += "<tr>";
        rows += "<td>" + file.score + "</td>";
        rows += "<td title=\"" + file.filename + "\">" + shorten_filename(file.filename) + "</td>";
        rows += "<td>" + file.bugs.join(', ') + "</td>";
        rows += "</tr>";
    }

    var table = $('table#results');
    var tbody = table.find('tbody');
    tbody.empty();
    tbody.append(rows);

    //tell tablesorter that we changed the data underneath it
    table.trigger("update"); 
}

function shorten_filename(filename) {
    //if the full filename isn't that long, just use it
    if (filename.length < 75) {
        return filename;
    }

    //split the filename up on slashes
    var parts = filename.split('/');
<commit_msg>trim the bug score to be reasonable<commit_after>var RESULTS_LOCATION = "flypaper_results.json";

$(document).ready(function() {
    prepare_ui();
    get_json_via_ajax(RESULTS_LOCATION, update_ui);
});

function prepare_ui() {
    $("table#results").tablesorter();
}

function get_json_via_ajax(filename, callback) {
    $.ajax({
        type: "GET",
        url: filename,
        dataType: "json",
        success: function(data) {
            callback(data);
        }
    });
}

function update_ui(results) {
    var rows = "";
    for (var i in results.files) {
        var file = results.files[i];
        var score = new Number(file.score);
        rows += "<tr>";
        rows += "<td>" + score.toPrecision(4) + "</td>";
        rows += "<td title=\"" + file.filename + "\">" + shorten_filename(file.filename) + "</td>";
        rows += "<td>" + file.bugs.join(', ') + "</td>";
        rows += "</tr>";
    }

    var table = $('table#results');
    var tbody = table.find('tbody');
    tbody.empty();
    tbody.append(rows);

    //tell tablesorter that we changed the data underneath it
    table.trigger("update"); 
}

function shorten_filename(filename) {
    //if the full filename isn't that long, just use it
    if (filename.length < 75) {
        return filename;
    }

    //split the filename up on slashes
    var parts = filename.split('/');

{'fraction_non_alphanumeric': 0.1691785983421251, 'fraction_numerical': 0.0018839487565938207, 'mean_word_length': 2.5926928281461437, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, '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': '4522488', 'n_tokens_mistral': 839, 'n_tokens_neox': 805, 'n_words': 204}