<commit_before><template>
    <div class="card">
        <div class="card-header d-flex justify-content-between">
            {{ $t('Latest changes') }}
            <button
                class="btn-clear-history"
                id="clear-history"
                @click="clearHistory"
                v-if="filteredItems.length && clearButton"
            >
                {{ $t('Clear') }}
            </button>
        </div>

        <div class="history table-responsive" v-if="filteredItems.length">
            <table class="history-table table table-main mb-0">
                <thead>
                    <tr>
                        <slot :sort-array="sortArray" name="columns"></slot>
                    </tr>
                </thead>

                <tbody>
                    <tr v-for="model in filteredItems">
                        <td>
                            <small class="text-muted text-nowrap">{{ model.created_at | datetime }}</small>
                        </td>
                        <td>
                            <a v-if="model.href" :href="model.href + '?locale=' + model.locale">{{ model.title }}</a>
                            <span v-if="!model.href">{{ model.title }}</span>
                            <span v-if="model.locale">({{ model.locale }})</span>
                        </td>
                        <td>
                            {{ model.historable_type.substring(model.historable_type.lastIndexOf('\\') + 1) }}
                        </td>
                        <td class="action">
                            <small class="action-content">
                                <span class="icon" :class="'icon-' + model.action"></span>
                                {{ model.action }}
                            </small>
                        </td>
                        <td>
                            <small class="user-name">{{ model.user_name }}</small>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

        <div class="card-body" v-else>
            <div v-if="loading">
                <span class="text-muted">{{ $t('Loading…') }}</span>
            </div>
            <div v-else>
                <span class="text-muted">{{
                    searchString !== '' ? $t('Nothing found.') : $t('History is empty.')
                }}</span>
            </div>
        </div>
        <div class="card-footer" v-if="data.total > data.per_page">
            <item-list-pagination
                class="justify-content-center"
                :data="data"
                @pagination-change-page="changePage"
                v-if="pagination"
            ></item-list-pagination>
        </div>
    </div>
</template>

<script>
import ItemListPagination from './ItemListPagination';

export default {
    components: {
        ItemListPagination,
    },
    props: {
        clearButton: {
            type: Boolean,
            default: false,<commit_msg>Update History.vue<commit_after><template>
    <div class="card">
        <div class="card-header d-flex justify-content-between">
            {{ $t('Latest changes') }}
            <button
                class="btn-clear-history"
                id="clear-history"
                @click="clearHistory"
                v-if="filteredItems.length > 0 && clearButton"
            >
                {{ $t('Clear') }}
            </button>
        </div>

        <div class="history table-responsive" v-if="filteredItems.length">
            <table class="history-table table table-main mb-0">
                <thead>
                    <tr>
                        <slot :sort-array="sortArray" name="columns"></slot>
                    </tr>
                </thead>

                <tbody>
                    <tr v-for="model in filteredItems">
                        <td>
                            <small class="text-muted text-nowrap">{{ model.created_at | datetime }}</small>
                        </td>
                        <td>
                            <a v-if="model.href" :href="model.href + '?locale=' + model.locale">{{ model.title }}</a>
                            <span v-if="!model.href">{{ model.title }}</span>
                            <span v-if="model.locale">({{ model.locale }})</span>
                        </td>
                        <td>
                            {{ model.historable_type.substring(model.historable_type.lastIndexOf('\\') + 1) }}
                        </td>
                        <td class="action">
                            <small class="action-content">
                                <span class="icon" :class="'icon-' + model.action"></span>
                                {{ model.action }}
                            </small>
                        </td>
                        <td>
                            <small class="user-name">{{ model.user_name }}</small>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

        <div class="card-body" v-else>
            <div v-if="loading">
                <span class="text-muted">{{ $t('Loading…') }}</span>
            </div>
            <div v-else>
                <span class="text-muted">{{
                    searchString !== '' ? $t('Nothing found.') : $t('History is empty.')
                }}</span>
            </div>
        </div>
        <div class="card-footer" v-if="filteredItems.length > 0 && data.total > data.per_page">
            <item-list-pagination
                class="justify-content-center"
                :data="data"
                @pagination-change-page="changePage"
                v-if="pagination"
            ></item-list-pagination>
        </div>
    </div>
</template>

<script>
import ItemListPagination from './ItemListPagination';

export default {
    components: {
        ItemListPagination,
    },
    props: {
        clearButton: {
            type: Boolean,
            default: false,
{'fraction_non_alphanumeric': 0.14666445952656845, 'fraction_numerical': 0.0009932130441979805, 'mean_word_length': 1.0892116182572613, 'pattern_counts': {'":': 0, '<': 125, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6257469', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1524, 'n_words': 283}