<commit_before><?php
/* @var $this \yii\web\View */
/* @var $manifest array */
/* @var $searchModel \yii\debug\models\search\Debug */
/* @var $dataProvider ArrayDataProvider */
/* @var $panels \yii\debug\Panel[] */

use yii\data\ArrayDataProvider;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\helpers\Url;

$this->title = 'Yii Debugger';

?>
<div class="default-index">
    <div id="yii-debug-toolbar" class="yii-debug-toolbar yii-debug-toolbar_position_top" style="display: none;">
        <div class="yii-debug-toolbar__bar">
            <div class="yii-debug-toolbar__block yii-debug-toolbar__title">
                <a href="#">
                    <img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
                </a>
            </div>
            <?php foreach ($panels as $panel): ?>
                <?= $panel->getSummary() ?>
            <?php endforeach; ?>
        </div>
    </div>

    <div class="container">
        <div class="row">
<?php

if (isset($this->context->module->panels['db']) && isset($this->context->module->panels['request'])) {

    echo "			<h1>Available Debug Data</h1>";

    $codes = [];
    foreach ($manifest as $tag => $vals) {
        if (!empty($vals['statusCode'])) {
            $codes[] = $vals['statusCode'];
        }
    }
    $codes = array_unique($codes, SORT_NUMERIC);
    $statusCodes = !empty($codes) ? array_combine($codes, $codes) : null;

    echo GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'rowOptions' => function ($model, $key, $index, $grid) use ($searchModel) {
            $dbPanel = $this->context->module->panels['db'];

            if ($searchModel->isCodeCritical($model['statusCode']) || $dbPanel->isQueryCountCritical($model['sqlCount'])) {
                return ['class'=>'danger'];
            } else {
                return [];
            }
        },
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            [
                'attribute' => 'tag',
                'value' => function ($data) {
                    return Html::a($data['tag'], ['view', 'tag' => $data['tag']]);
                },
                'format' => 'raw',
            ],
            [
                'attribute' => 'time',
                'value' => function ($data) {
                    $html = '<span class="nowrap ">' . Yii::$app->formatter->asDatetime($data['time'], 'yyyy-MM-dd HH:mm:ss') . '</span><br/>';

                    if (!empty($data['profilingTime'])) {
                        $time = number_format($data['profilingTime'] * 1000) . ' ms';
                        $memory = sprintf('%.3f MB', $data['profilingMemory'] / 1048576);
                        $numFiles = !empty($data['profilingNumFiles']) ? $data['profilingNumFiles'] . ' files' : '';

                        $html .= '<div class="nowrap">';
                        $html .= '<span class="yii-debug-toolbar__label yii-debug-toolbar__label_info">' . $time . '</span> ';
                        $html .= '<span class="yii-debug-toolbar__label yii-debug-toolbar__label_info">' . $memory . '</span> ';
                        $html .= '<span class="yii-debug-toolbar__label yii-debug-toolbar__label_info">' . $numFiles . '</span> ';
                        $html .= '</div>';
                    }

                    return $html;
                },
                'format' => 'raw',
            ],
            'ip',
            [
                'attribute' => 'sqlCount',<commit_msg>add link for index profiling column<commit_after><?php
/* @var $this \yii\web\View */
/* @var $manifest array */
/* @var $searchModel \yii\debug\models\search\Debug */
/* @var $dataProvider ArrayDataProvider */
/* @var $panels \yii\debug\Panel[] */

use yii\data\ArrayDataProvider;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\helpers\Url;

$this->title = 'Yii Debugger';

?>

<style>
.link-hover:hover {
    text-decoration: none;
    color: #4fb8ff;
}
</style>

<div class="default-index">
    <div id="yii-debug-toolbar" class="yii-debug-toolbar yii-debug-toolbar_position_top" style="display: none;">
        <div class="yii-debug-toolbar__bar">
            <div class="yii-debug-toolbar__block yii-debug-toolbar__title">
                <a href="#">
                    <img width="29" height="30" alt="" src="<?= \yii\debug\Module::getYiiLogo() ?>">
                </a>
            </div>
            <?php foreach ($panels as $panel): ?>
                <?= $panel->getSummary() ?>
            <?php endforeach; ?>
        </div>
    </div>

    <div class="container">
        <div class="row">
<?php

if (isset($this->context->module->panels['db']) && isset($this->context->module->panels['request'])) {

    echo "			<h1>Available Debug Data</h1>";

    $codes = [];
    foreach ($manifest as $tag => $vals) {
        if (!empty($vals['statusCode'])) {
            $codes[] = $vals['statusCode'];
        }
    }
    $codes = array_unique($codes, SORT_NUMERIC);
    $statusCodes = !empty($codes) ? array_combine($codes, $codes) : null;

    echo GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'rowOptions' => function ($model, $key, $index, $grid) use ($searchModel) {
            $dbPanel = $this->context->module->panels['db'];

            if ($searchModel->isCodeCritical($model['statusCode']) || $dbPanel->isQueryCountCritical($model['sqlCount'])) {
                return ['class'=>'danger'];
            } else {
                return [];
            }
        },
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            [
                'attribute' => 'tag',
                'value' => function ($data) {
                    return Html::a($data['tag'], ['view', 'tag' => $data['tag']], ['class' => 'link-hover']);
                },
                'format' => 'raw',
            ],
            [
                'attribute' => 'time',
                'value' => function ($data) {
                    $href = Url::to(['view', 'tag' => $data['tag'], 'panel' => 'profiling']);
                    $html = '<a class="nowrap link-hover" href="' . $href . '">';
                    $html .= '<span class="nowrap ">' . Yii::$app->formatter->asDatetime($data['time'], 'yyyy-MM-dd HH:mm:ss') . '</span><br/>';
                    if (!empty($data['profilingTime'])) {
                        $time = number_format($data['profilingTime'] * 1000) . ' ms';
                        $memory = sprintf('%.3f MB', $data['profilingMemory'] / 1048576);
                        $numFiles = !empty($data['profilingNumFiles']) ? $data['profilingNumFiles'] . ' files' : '';
                        $html .= '<span class="yii-debug-toolbar__label yii-debug-toolbar__label_info">' . $time . '</span> ';
                        $html .= '<span class="yii-debug-toolbar__label yii-debug-toolbar__label_info">' . $memory . '</span> ';
                        $html .= '<span class="yii-debug-toolbar__label yii-debug-toolbar__label_info">' . $numFiles . '</span> ';
                        $html .= '</div>';
                    }
                    $html .= '</a>';
                    return $html;
                },
                'format' => 'raw',
            ],
            'ip',
            [
                'attribute' => 'sqlCount',
{'fraction_non_alphanumeric': 0.1933649289099526, 'fraction_numerical': 0.005145565335138795, 'mean_word_length': 1.8616815187911662, 'pattern_counts': {'":': 0, '<': 68, '<?xml version=': 0, '>': 129, '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': '7426168', 'n_tokens_mistral': 2276, 'n_tokens_neox': 2160, 'n_words': 394}