<commit_before><style scoped>
nav{
    margin: 0 0 15px 0;
} 
.pagination{
    margin: 0;
}
</style>

<template>
    <nav aria-label="Page navigation" v-show="pagination.total > pagination.per_page">
        <ul class="pagination" :class="classes">
            <li class="page-item disabled" v-if="pagination.current_page == 1">
                <a class="page-link">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <li class="page-item" v-else>
                <a class="page-link" @click="setPage(pagination.current_page - 1)" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <li class="page-item">
                <a class="page-link" @click="setPage(1)" v-if="pagination.current_page >= 4">1</a>
            </li>
            <li class="page-item disabled" v-if="pagination.current_page >= 5">
                <a class="page-link">...</a>
            </li>
            <li class="page-item" v-for="p in pagination.last_page" 
                :class="{'active': p === pagination.current_page}"
                v-if="p >= pagination.current_page - 2 && p <= pagination.current_page + 2">
                <a class="page-link" @click="setPage(p)" v-if="p !== pagination.current_page">{{ p }}</a>
                <a class="page-link" v-else>{{ p }}</a>
            </li>
            <li class="page-item disabled" v-if="pagination.current_page <= pagination.last_page - 4">
                <a class="page-link">...</a>
            </li>
            <li class="page-item">
                <a class="page-link" @click="setPage(pagination.last_page)" v-if="pagination.current_page <= pagination.last_page - 3">{{ pagination.last_page }}</a>
            </li>
            <li class="page-item disabled" v-if="pagination.current_page == pagination.last_page">
                <a class="page-link">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
            <li class="page-item" v-else>
                <a class="page-link" @click="setPage(pagination.current_page + 1)" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
        </ul>
    </nav>
</template>

<script>
    export default {
        props: {
            pagination: {
                type: Object,
                required: true
            },
            classes: {
                type: String,
                required: false,
                default: ''
            }
        },

        methods: {
            setPage(page){
                this.$emit('change', page);
            }
        }
    }
</script><commit_msg>Pagination fix<commit_after><style scoped>
nav{
    margin: 0 0 15px 0;
} 
.pagination{
    margin: 0;
}
</style>

<template>
    <nav aria-label="Page navigation" v-show="pagination.total > pagination.per_page" :class="classes">
        <ul class="pagination">
            <li class="page-item disabled" v-if="pagination.current_page == 1">
                <a class="page-link" href="#">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <li class="page-item" v-else>
                <a class="page-link" href="#" @click="setPage(pagination.current_page - 1)" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#" @click="setPage(1)" v-if="pagination.current_page >= 4">1</a>
            </li>
            <li class="page-item disabled" v-if="pagination.current_page >= 5">
                <a class="page-link" href="#">...</a>
            </li>
            <li class="page-item" v-for="p in pagination.last_page" 
                :class="{'active': p === pagination.current_page}"
                v-if="p >= pagination.current_page - 2 && p <= pagination.current_page + 2">
                <a class="page-link" href="#" @click="setPage(p)" v-if="p !== pagination.current_page">{{ p }}</a>
                <a class="page-link" href="#" v-else>{{ p }}</a>
            </li>
            <li class="page-item disabled" v-if="pagination.current_page <= pagination.last_page - 4">
                <a class="page-link" href="#">...</a>
            </li>
            <li class="page-item">
                <a class="page-link" href="#" @click="setPage(pagination.last_page)" v-if="pagination.current_page <= pagination.last_page - 3">{{ pagination.last_page }}</a>
            </li>
            <li class="page-item disabled" v-if="pagination.current_page == pagination.last_page">
                <a class="page-link" href="#">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
            <li class="page-item" v-else>
                <a class="page-link" href="#" @click="setPage(pagination.current_page + 1)" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
        </ul>
    </nav>
</template>

<script>
    export default {
        props: {
            pagination: {
                type: Object,
                required: true
            },
            classes: {
                type: String,
                required: false,
                default: ''
            }
        },

        methods: {
            setPage(page){
                this.$emit('change', page);
            }
        }
    }
</script>
{'fraction_non_alphanumeric': 0.17176596886741816, 'fraction_numerical': 0.006083378064054392, 'mean_word_length': 1.5736648250460405, 'pattern_counts': {'":': 0, '<': 121, '<?xml version=': 0, '>': 123, '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': '1045853', 'n_tokens_mistral': 1738, 'n_tokens_neox': 1642, 'n_words': 316}