<commit_before><?php
    /*
    Expect:
    
    $dbSchemaDiagnostics = array(
        $table_name1 => array(
            'description' => $description1,
            'column_name' => $column_name1,
            'actual' => array(
                (int) 0 => 'object_relation',
                (int) 1 => 'varchar(128)',
                [...]
            ),
            'expected' => array(
                (int) 0 => 'object_relation',
                (int) 1 => 'varchar(255)',
                [...]
            )
        ),
        [...]
    );


    */



    function highlightAndSanitize($dirty, $to_highlight, $color_type = 'success')
    {
        if (is_array($dirty)) {
            $array_sane = array();
            foreach ($dirty as $i => $item) {
                if (in_array($item, $to_highlight)) {
                    $array_sane[] = sprintf('<span class="label label-%s">', $color_type) . h($item) . '</span>';
                } else {
                    $array_sane[] = h($item);
                }
            }
            return $array_sane;
        } else {
            $sane = h($dirty);
            $sane = str_replace($to_highlight, sprintf('<span class="label label-%s">', $color_type)  . h($to_highlight) . '</span>', $sane);
            return $sane;
        }
    }
?>

<?php
    if (count($dbSchemaDiagnostics) > 0) {
        echo sprintf('<span  style="margin-bottom: 5px;" class="label label-important" title="%s">%s<i style="font-size: larger;" class="fas fa-times"></i></span>',
            __('The current database schema does not match the excpect format'),
            __('Database schema diagnostic: ')
        );
        $table = sprintf('%s%s%s', 
            '<table class="table table-bordered table-condensed">',
            sprintf('<thead><th>%s</th><th>%s</th><th>%s</th><th>%s</th></thead>', __('Table name'),  __('Description'), __('Expected schema'), __('Actual schema')),
            '<tbody>'
        );
        $rows = '';
        foreach ($dbSchemaDiagnostics as $table_name => $table_diagnostic) {
            $rows .= '<tr>';
                $rows .= sprintf('<td rowspan="%s" colspan="0" class="bold">%s</td>', count($table_diagnostic)+1, h($table_name));
            $rows .= '</tr>';<commit_msg>chg: [dbSchemaDiagnostic] Added big warning if dabase is in inconsistent state<commit_after><?php
    /*
    Expect:
    
    $dbSchemaDiagnostics = array(
        $table_name1 => array(
            'description' => $description1,
            'column_name' => $column_name1,
            'actual' => array(
                (int) 0 => 'object_relation',
                (int) 1 => 'varchar(128)',
                [...]
            ),
            'expected' => array(
                (int) 0 => 'object_relation',
                (int) 1 => 'varchar(255)',
                [...]
            )
        ),
        [...]
    );


    */



    function highlightAndSanitize($dirty, $to_highlight, $color_type = 'success')
    {
        if (is_array($dirty)) {
            $array_sane = array();
            foreach ($dirty as $i => $item) {
                if (in_array($item, $to_highlight)) {
                    $array_sane[] = sprintf('<span class="label label-%s">', $color_type) . h($item) . '</span>';
                } else {
                    $array_sane[] = h($item);
                }
            }
            return $array_sane;
        } else {
            $sane = h($dirty);
            $sane = str_replace($to_highlight, sprintf('<span class="label label-%s">', $color_type)  . h($to_highlight) . '</span>', $sane);
            return $sane;
        }
    }
?>

<?php
    if (count($dbSchemaDiagnostics) > 0) {
        echo sprintf('<span  style="margin-bottom: 5px;" class="label label-important" title="%s">%s<i style="font-size: larger;" class="fas fa-times"></i></span>',
            __('The current database schema does not match the expected format'),
            __('Database schema diagnostic: ')
        );
        echo sprintf('<div class="alert alert-error"><strong>%s</strong> %s</div>',
            __('Critical warning!'),
            __('The MISP database seems to be in an inconsistent state. Immediate attention is required.')
        );
        $table = sprintf('%s%s%s', 
            '<table class="table table-bordered table-condensed">',
            sprintf('<thead><th>%s</th><th>%s</th><th>%s</th><th>%s</th></thead>', __('Table name'),  __('Description'), __('Expected schema'), __('Actual schema')),
            '<tbody>'
        );
        $rows = '';
        foreach ($dbSchemaDiagnostics as $table_name => $table_diagnostic) {
            $rows .= '<tr>';
                $rows .= sprintf('<td rowspan="%s" colspan="0" class="bold">%s</td>', count($table_diagnostic)+1, h($table_name));
            $rows .= '</tr>';
{'fraction_non_alphanumeric': 0.18285833159975037, 'fraction_numerical': 0.007073018514666112, 'mean_word_length': 1.8382526564344746, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 81, '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': '4887649', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1422, 'n_words': 288}