<commit_before><?php
/**
 * Tatoeba Project, free collaborative creation of multilingual corpuses project
 * Copyright (C) 2009  <NAME> <<EMAIL>>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * PHP version 5
 *
 * @category PHP
 * @package  Tatoeba
 * @author   <NAME> <<EMAIL>>
 * @license  Affero General Public License
 * @link     https://tatoeba.org
 */
use App\Model\CurrentUser;

$categories = array(
    'ok' => ['check_circle', __('Sentences marked as "OK"')],
    'unsure' => ['help', __('Sentences marked as "unsure"')],
    'not-ok' => ['error', __('Sentences marked as "not OK"')],
    'all' => ['keyboard_arrow_right', __("All sentences")],
    'outdated' => ['keyboard_arrow_right', __("Outdated reviews")]
);

if (empty($correctnessLabel) || !in_array($correctnessLabel, $categories)) {
    $category = $categories['all'][1];
} else {
    $category = $categories[$correctnessLabel][1];
}

if ($userExists) {
    $title = format(
        __("{user}'s reviews - {category}"),
        array('user' => $username, 'category' => $category)
    );
} else {
    $title = format(__("There's no user called {username}"), array('username' => $username));
}

$this->set('title_for_layout', $this->Pages->formatTitle($title));
?>

<?php if ($userExists) : ?>
<div id="annexe_content" ng-cloak>
    <?php
    if (!CurrentUser::get('settings.users_collections_ratings')) {
        echo '<div class="module">';
        echo $this->Html->tag('p', __('This feature is currently deactivated.'));
        echo $this->Html->tag('p',
            __(
                'You can activate it in your settings: "Activate the feature to review sentences."',
                true
            )
        );
        echo '</div>';
    }
    ?>

    <md-list class="annexe-menu md-whiteframe-1dp" ng-cloak>
        <?php /* @translators: header text in the sidebar of a list of reviews (verb) */ ?>
        <md-subheader><?= __('Filter') ?></md-subheader>
        <?php
        foreach($categories as $categoryKey => $categoryValue) {
            $url = $this->Url->build([
                'action' => 'of',
                $username,
                $categoryKey
            ]);
            ?>
            <md-list-item href="<?= $url ?>">
                <md-icon><?= $categoryValue[0] ?></md-icon>
                <p><?= $categoryValue[1] ?></p>
            </md-list-item>
            <?php
        }
        ?>
    </md-list>
</div>
<?php endif; ?>

<div id="main_content">
    <section class="md-whiteframe-1dp correctness-info">
        <?php
        if (!$userExists) {
            $this->CommonModules->displayNoSuchUser($username);
        } else {
            $title = $this->Paginator->counter(array(
                'format' => $title . ' ' . __("(total {{count}})")
            ));
            ?>
        <md-toolbar class="md-hue-2">
            <div class="md-toolbar-tools">
                <h2><?= $title ?></h2>

                <?php 
                    $options = array(
                        /* @translators: sort option in the list of reviews */
                        array('param' => 'modified', 'direction' => 'desc', 'label' => __x('reviews', 'Most recently updated')),
                        /* @translators: sort option in the list of reviews */
                        array('param' => 'modified', 'direction' => 'asc', 'label' => __x('reviews', 'Least recently updated')),<commit_msg>Add language filter on Reviews page<commit_after><?php
/**
 * Tatoeba Project, free collaborative creation of multilingual corpuses project
 * Copyright (C) 2009  <NAME> <<EMAIL>>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * PHP version 5
 *
 * @category PHP
 * @package  Tatoeba
 * @author   <NAME> <<EMAIL>>
 * @license  Affero General Public License
 * @link     https://tatoeba.org
 */
use App\Model\CurrentUser;

$categories = array(
    'ok' => ['check_circle', __('Sentences marked as "OK"')],
    'unsure' => ['help', __('Sentences marked as "unsure"')],
    'not-ok' => ['error', __('Sentences marked as "not OK"')],
    'all' => ['keyboard_arrow_right', __("All sentences")],
    'outdated' => ['keyboard_arrow_right', __("Outdated reviews")]
);

if (empty($correctnessLabel) || !in_array($correctnessLabel, $categories)) {
    $category = $categories['all'][1];
} else {
    $category = $categories[$correctnessLabel][1];
}

if ($userExists) {
    $title = format(
        __("{user}'s reviews - {category}"),
        array('user' => $username, 'category' => $category)
    );
} else {
    $title = format(__("There's no user called {username}"), array('username' => $username));
}

$this->set('title_for_layout', $this->Pages->formatTitle($title));
?>

<?php if ($userExists) : ?>
<div id="annexe_content" ng-cloak>
    <?php
    if (!CurrentUser::get('settings.users_collections_ratings')) {
        echo '<div class="module">';
        echo $this->Html->tag('p', __('This feature is currently deactivated.'));
        echo $this->Html->tag('p',
            __(
                'You can activate it in your settings: "Activate the feature to review sentences."',
                true
            )
        );
        echo '</div>';
    }
    ?>

    <md-list class="annexe-menu md-whiteframe-1dp" ng-cloak>
        <?php /* @translators: header text in the sidebar of a list of reviews (verb) */ ?>
        <md-subheader><?= __('Filter') ?></md-subheader>
        <?php
        foreach($categories as $categoryKey => $categoryValue) {
            $url = $this->Url->build([
                'action' => 'of',
                $username,
                $categoryKey
            ]);
            ?>
            <md-list-item href="<?= $url ?>">
                <md-icon><?= $categoryValue[0] ?></md-icon>
                <p><?= $categoryValue[1] ?></p>
            </md-list-item>
            <?php
        }
        ?>
    </md-list>

    <?php $this->CommonModules->createFilterByLangMod(3); ?>
</div>
<?php endif; ?>

<div id="main_content">
    <section class="md-whiteframe-1dp correctness-info">
        <?php
        if (!$userExists) {
            $this->CommonModules->displayNoSuchUser($username);
        } else {
            $title = $this->Paginator->counter(array(
                'format' => $title . ' ' . __("(total {{count}})")
            ));
            ?>
        <md-toolbar class="md-hue-2">
            <div class="md-toolbar-tools">
                <h2><?= $title ?></h2>

                <?php 
                    $options = array(
                        /* @translators: sort option in the list of reviews */
                        array('param' => 'modified', 'direction' => 'desc', 'label' => __x('reviews', 'Most recently updated')),
                        /* @translators: sort option in the list of reviews */
                        array('param' => 'modified', 'direction' => 'asc', 'label' => __x('reviews', 'Least recently updated')),
{'fraction_non_alphanumeric': 0.1618369351669941, 'fraction_numerical': 0.003806483300589391, 'mean_word_length': 2.4051003344481607, 'pattern_counts': {'":': 0, '<': 86, '<?xml version=': 0, '>': 146, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '5257804', 'n_tokens_mistral': 2382, 'n_tokens_neox': 2333, 'n_words': 684}