<commit_before>var depth = 0, depthStep = 20;
var levelsStack = [];

Array.prototype.top = function(){
    return this.length > 0 ? this[this.length-1] : undefined;
};

function setFixedProperties(currentTest, element) {
    $(element).find("#name").text(currentTest.name);
    $(element).find("#timestamp").text(currentTest.date + " " + currentTest.timestamp);
    $(element).find("#description").text(currentTest.description);
}

function addPropertiesToTbl(properties, table) {
    for (var key in properties) {
        var tr = $('<tr>');
        tr.append($('<td>').text(key));
        tr.append($('<td>').text(properties[key]));
        $(table).append(tr);
    }
}

function setCustomProperties(currentTest,element) {
    addPropertiesToTbl(currentTest.properties, $(element).find("#propTbl > tbody"));
}

function setParameters(currentTest,element) {
    addPropertiesToTbl(currentTest.parameters, $(element).find("#paramTbl > tbody"));
}

function createDetailsTable() {

}

function isPropertyExist(element, property) {
    return (element.hasOwnProperty(property) && element[property] !== null && element[property] !== "");
}

function addStatusAsClass(elementToAppend, elementWithStatus) {
    if (isPropertyExist(elementWithStatus, "status")) {
        elementToAppend.addClass("s_" + elementWithStatus.status +"_text");
    }
}

function setRegularElement($container, element, isHtml) {
    var $div = $("<div>");
    var $timestamp = $("<span>").addClass('timestamp').text(element.time);

    if (isPropertyExist(element, "message")) {
        var $content = $("<span>").addClass('innerToggle').text(element.title);
        indent($content);
        $div.append($timestamp).append($content);

        // add inner div with the message
        var $innerDiv = $("<div>").html(nl2br(element.message));
        $innerDiv.css("margin-left", (depth+depthStep) + "px");
        $div.append($innerDiv);
    }
    else{
        var $content = isHtml ? $("<span>").html(element.title) :  $("<span>").text(element.title);
        indent($content);
        $div.append($timestamp).append($content);
    }

    addStatusAsClass($div, element);
    appendElement($container, $div);
}

function setStartLevelElement($container, element) {
    var $timestamp = $("<span>").addClass('timestamp').text(element.time);
    var $content = $("<span>").addClass('startLevel').addClass("closed").text(element.title);
    var $div = $("<div>").append($timestamp).append($content);
    indent($content);

    addStatusAsClass($div, element);
    appendElement($container, $div);

    // push the div into the level stack
    levelsStack.push($div);

    // increase depth (left margin)
    depth += depthStep;
}

function setStopLevelElement(element) {
    if(!$.isEmptyObject(levelsStack)){
        levelsStack.pop();
    }

    // decrease depth as level closed
    depth -= depthStep;
}

function setStepElement($container, element) {
    var $timestamp = $("<span>").addClass('timestamp').text(element.time);
    var $content = $("<span>").text(element.title);
    var $div = $("<div>").append($timestamp).append($content);
    indent($content);

    $div.addClass("step");

    addStatusAsClass($div, element);
    appendElement($container, $div);<commit_msg>Small change for making sure that the level indentation will not get below zero. Thanks Alik<commit_after>var depth = 0, depthStep = 20;
var levelsStack = [];

Array.prototype.top = function(){
    return this.length > 0 ? this[this.length-1] : undefined;
};

function setFixedProperties(currentTest, element) {
    $(element).find("#name").text(currentTest.name);
    $(element).find("#timestamp").text(currentTest.date + " " + currentTest.timestamp);
    $(element).find("#description").text(currentTest.description);
}

function addPropertiesToTbl(properties, table) {
    for (var key in properties) {
        var tr = $('<tr>');
        tr.append($('<td>').text(key));
        tr.append($('<td>').text(properties[key]));
        $(table).append(tr);
    }
}

function setCustomProperties(currentTest,element) {
    addPropertiesToTbl(currentTest.properties, $(element).find("#propTbl > tbody"));
}

function setParameters(currentTest,element) {
    addPropertiesToTbl(currentTest.parameters, $(element).find("#paramTbl > tbody"));
}

function createDetailsTable() {

}

function isPropertyExist(element, property) {
    return (element.hasOwnProperty(property) && element[property] !== null && element[property] !== "");
}

function addStatusAsClass(elementToAppend, elementWithStatus) {
    if (isPropertyExist(elementWithStatus, "status")) {
        elementToAppend.addClass("s_" + elementWithStatus.status +"_text");
    }
}

function setRegularElement($container, element, isHtml) {
    var $div = $("<div>");
    var $timestamp = $("<span>").addClass('timestamp').text(element.time);

    if (isPropertyExist(element, "message")) {
        var $content = $("<span>").addClass('innerToggle').text(element.title);
        indent($content);
        $div.append($timestamp).append($content);

        // add inner div with the message
        var $innerDiv = $("<div>").html(nl2br(element.message));
        $innerDiv.css("margin-left", (depth+depthStep) + "px");
        $div.append($innerDiv);
    }
    else{
        var $content = isHtml ? $("<span>").html(element.title) :  $("<span>").text(element.title);
        indent($content);
        $div.append($timestamp).append($content);
    }

    addStatusAsClass($div, element);
    appendElement($container, $div);
}

function setStartLevelElement($container, element) {
    var $timestamp = $("<span>").addClass('timestamp').text(element.time);
    var $content = $("<span>").addClass('startLevel').addClass("closed").text(element.title);
    var $div = $("<div>").append($timestamp).append($content);
    indent($content);

    addStatusAsClass($div, element);
    appendElement($container, $div);

    // push the div into the level stack
    levelsStack.push($div);

    // increase depth (left margin)
    depth += depthStep;
}

function setStopLevelElement(element) {
    if(!$.isEmptyObject(levelsStack)){
        levelsStack.pop();
    }

    // decrease depth as level closed
    depth -= depthStep;

    //make sure we don't slide left more
    //than needed... Thanks Alik.
    if (depth<0) {
        depth = 0;
    }
}

function setStepElement($container, element) {
    var $timestamp = $("<span>").addClass('timestamp').text(element.time);
    var $content = $("<span>").text(element.title);
    var $div = $("<div>").append($timestamp).append($content);
    indent($content);

    $div.addClass("step");

    addStatusAsClass($div, element);
    appendElement($container, $div);
{'fraction_non_alphanumeric': 0.18085582227523483, 'fraction_numerical': 0.0020873714030117787, 'mean_word_length': 4.105022831050229, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 39, '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': '2409961', 'n_tokens_mistral': 1979, 'n_tokens_neox': 1945, 'n_words': 363}