<commit_before>util_log("Preparing sandbox to intercept 'new Function()' calls.");
_Function_calls = [];

var Function = function() {
    _orig_Function = Function;
    _orig_Function.toString = () => {
        return "_orig_Function";
    }
    return function() {
        _fn_id = id++;
        _Function_calls[_Function_calls.length] = Array.prototype.slice.call(arguments).join(",");
        util_log("new Function(" + _truncateOutput(Array.prototype.slice.call(arguments).join(", ")) + ") => Function[" + _fn_id + "]");
        // Inject logger into the new function created
        var new_args = arguments;
        var orig_body = arguments[new_args.length - 1];
        //util_log("orig: " + orig_body);
        var orig_fn = "function(" + Array.prototype.slice.call(arguments, 0, -1).join(", ") + ") {" + orig_body + "}"
        var used_body = "var fn = " + orig_fn + "; var ret = fn.apply(this, arguments); util_log(\"Returning: '\"+ret+\"'\"); return ret;";
        //var escaped_fn = orig_fn.replace(/\"/g, "\\\"");
        used_body = "util_log('Calling Function[" + _fn_id +
            "]('+_truncateOutput(Array.prototype.slice.call(arguments).join(\", \"))+') on ' + _truncateOutput(this));" + used_body;
        new_args[new_args.length - 1] = used_body;<commit_msg>Store new Function params under its ID<commit_after>util_log("Preparing sandbox to intercept 'new Function()' calls.");
_Function_calls = {};

var Function = function() {
    _orig_Function = Function;
    _orig_Function.toString = () => {
        return "_orig_Function";
    }
    return function() {
        _fn_id = id++;
        _name = "Function[" + _fn_id + "]";
        _Function_calls[_name] = Array.prototype.slice.call(arguments); //.join(",");
        util_log("new Function(" + _truncateOutput(Array.prototype.slice.call(arguments).join(", ")) + ") => " + _name);
        // Inject logger into the new function created
        var new_args = arguments;
        var orig_body = arguments[new_args.length - 1];
        //util_log("orig: " + orig_body);
        var orig_fn = "function(" + Array.prototype.slice.call(arguments, 0, -1).join(", ") + ") {" + orig_body + "}"
        var used_body = "var fn = " + orig_fn + "; var ret = fn.apply(this, arguments); util_log(\"Returning: '\"+ret+\"'\"); return ret;";
        //var escaped_fn = orig_fn.replace(/\"/g, "\\\"");
        used_body = "util_log('Calling Function[" + _fn_id +
            "]('+_truncateOutput(Array.prototype.slice.call(arguments).join(\", \"))+') on ' + _truncateOutput(this));" + used_body;
        new_args[new_args.length - 1] = used_body;
{'fraction_non_alphanumeric': 0.18199233716475097, 'fraction_numerical': 0.0030651340996168583, 'mean_word_length': 3.1053459119496853, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6489373', 'n_tokens_mistral': 838, 'n_tokens_neox': 827, 'n_words': 162}