<commit_before><?php
/* @var $this yii\web\View */

use yii\helpers\Html;

?>

<style>
.button{
border-radius: .1875em;
padding:4px;
margin:0px 4px;
box-shadow: inset 0 2px 2px #fff,0 0 0 1px #bbb,0 1px 1px #aaa;
}
</style>

<table class="table"><tr><th></th><th>Count</th><th>Since</th><th></th></tr>
<?php 
foreach($counters as $counter): 
    $interval = $counter->getDateInterval();
?>

    <tr>
        <th><?php echo Html::encode($counter->label)?></th>
        <td><span style="
            background-image:url('<?=Yii::getAlias('@web')?>/images/flair.png');
            background-repeat:no-repeat;
            background-position:<?=getImageCoord($interval)?>;
            display:inline-block;
            height: 20px;
            width: 20px;
            margin-right: 4px;
            vertical-align: middle;"></span>
            <span><?= getCountStr($interval)?></span>
        </td>
        <td><?= $counter->startDate?></td>
        <td align="right"><img src="<?=Yii::getAlias('@web')?>/images/reset.png" class="button"/> <img src="<?=Yii::getAlias('@web')?>/images/x.png" class="button"/></td>
    </tr>
<?php endforeach;?>
</table>

<?php

/**
 * Get formatted string of day count.
 * @param $interval DateInterval object
 * @return a string.
 */
function getCountStr($interval)
{
    $result = $interval->days . ' days';
    if($interval->y > 0)
        $result = $result . ' (' . $interval->y . ' year' . ($interval->y > 1 ? 's' : '') . ')';
    else if($interval->m > 0)
        $result = $result . ' (' . $interval->m . ' year' . ($interval->m > 1 ? 's' : '') . ')';
    return $result;
}

/**
 * Badge image coordinates.
 * @param $interval DateInterval object.
 * @return a string with the format Xpx Ypx, where X and Y are coordinates.
 */
function getImageCoord($interval)
{
    if($interval->days < 7) return '0px 0px';
<commit_msg>Fix bug that display year instead of month.<commit_after><?php
/* @var $this yii\web\View */

use yii\helpers\Html;

?>

<style>
.button{
border-radius: .1875em;
padding:4px;
margin:0px 4px;
box-shadow: inset 0 2px 2px #fff,0 0 0 1px #bbb,0 1px 1px #aaa;
}
</style>

<table class="table"><tr><th></th><th>Count</th><th>Since</th><th></th></tr>
<?php 
foreach($counters as $counter): 
    $interval = $counter->getDateInterval();
?>

    <tr>
        <th><?php echo Html::encode($counter->label)?></th>
        <td><span style="
            background-image:url('<?=Yii::getAlias('@web')?>/images/flair.png');
            background-repeat:no-repeat;
            background-position:<?=getImageCoord($interval)?>;
            display:inline-block;
            height: 20px;
            width: 20px;
            margin-right: 4px;
            vertical-align: middle;"></span>
            <span><?= getCountStr($interval)?></span>
        </td>
        <td><?= $counter->startDate?></td>
        <td align="right"><img src="<?=Yii::getAlias('@web')?>/images/reset.png" class="button"/> <img src="<?=Yii::getAlias('@web')?>/images/x.png" class="button"/></td>
    </tr>
<?php endforeach;?>
</table>

<?php

/**
 * Get formatted string of day count.
 * @param $interval DateInterval object
 * @return a string.
 */
function getCountStr($interval)
{
    $result = $interval->days . ' days';
    if($interval->y > 0)
        $result = $result . ' (' . $interval->y . ' year' . ($interval->y > 1 ? 's' : '') . ')';
    else if($interval->m > 0)
        $result = $result . ' (' . $interval->m . ' month' . ($interval->m > 1 ? 's' : '') . ')';
    return $result;
}

/**
 * Badge image coordinates.
 * @param $interval DateInterval object.
 * @return a string with the format Xpx Ypx, where X and Y are coordinates.
 */
function getImageCoord($interval)
{
    if($interval->days < 7) return '0px 0px';

{'fraction_non_alphanumeric': 0.2122503328894807, 'fraction_numerical': 0.01544607190412783, 'mean_word_length': 2.9003115264797508, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 113, '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': '1324477', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1283, 'n_words': 281}