<commit_before><template>
  <nav class="Pagination pagination" :class="modifiers">
    <template v-if="hasButtons">
      <a
        class="Pagination__previous pagination-previous"
        @click="previousPage"
        :disabled="!hasPreviousPage"
      >
        Previous
      </a>
      <a
        class="Pagination__next pagination-next"
        @click="nextPage"
        :disabled="!hasNextPage"
      >
        Next
      </a>
    </template>

    <ul class="Pagination__list pagination-list">
      <template v-if="showFirstPage">
        <li>
            <a
              class="Pagination__link pagination-link"
              :title="1"
              @click="setPage($event.target.title)"
            >
              1
            </a>
        </li>
        <li v-show="showLeftEllipsis">
          <span class="Pagination__ellipsis pagination-ellipsis">&hellip;</span>
        </li>
      </template>

      <li v-for="page in visiblePages" :key="page">
        <a
          class="Pagination__link pagination-link"
          :class="{ 'is-current': page === currentPage }"
          :title="page"
          @click="setPage($event.target.title)"
        >
          {{ page }}
        </a>
      </li>

      <template v-if="showLastPage">
        <li v-show="showRightEllipsis">
          <span class="Pagination__ellipsis pagination-ellipsis">&hellip;</span>
        </li>
        <li>
            <a
              class="Pagination__link pagination-link"
              :title="lastPage"
              @click="setPage($event.target.title)"
            >
              {{ lastPage }}
            </a>
        </li>
      </template>
    </ul>
  </nav>
</template>

<script>
import modifiers from '../utils/modifiers';

export default {
  name: 'pagination',
  props: {
    /**
     * The currently selected page.
     */
    currentPage: {
      type: Number,
      required: true,
    },

    /**
     * The number of items per page.
     */
    pageSize: Number,

    /**
     * The total number of items being paginated.
     */
    totalItems: Number,

    /**
     * The number of pages to pad the current page.
     */
    padding: {
      type: Number,
      default: 3,
    },

    /**
     * Determines whether to show next/previous buttons or not.
     */
    hasButtons: {
      type: Boolean,
      default: true,
    },

    /**
     * Bulma-specific options.
     */
    ...modifiers.props([...modifiers.sizes, ...modifiers.alignments]),
  },
  computed: {
    modifiers() {
      return modifiers.generate([...modifiers.sizes, ...modifiers.alignments], this.$props);
    },
    lastPage() {
      return Math.floor(this.totalItems / this.pageSize);
    },
    visiblePagesCount() {
      return Math.min((this.padding * 2) + 1, this.lastPage);
    },
    hasNextPage() {
      return this.currentPage < this.lastPage || !this.totalItems;
    },
    hasPreviousPage() {
      return this.currentPage > 1;
    },<commit_msg>Used ceil instead of floor for last page calculation on Pagination<commit_after><template>
  <nav class="Pagination pagination" :class="modifiers">
    <template v-if="hasButtons">
      <a
        class="Pagination__previous pagination-previous"
        @click="previousPage"
        :disabled="!hasPreviousPage"
      >
        Previous
      </a>
      <a
        class="Pagination__next pagination-next"
        @click="nextPage"
        :disabled="!hasNextPage"
      >
        Next
      </a>
    </template>

    <ul class="Pagination__list pagination-list">
      <template v-if="showFirstPage">
        <li>
            <a
              class="Pagination__link pagination-link"
              :title="1"
              @click="setPage($event.target.title)"
            >
              1
            </a>
        </li>
        <li v-show="showLeftEllipsis">
          <span class="Pagination__ellipsis pagination-ellipsis">&hellip;</span>
        </li>
      </template>

      <li v-for="page in visiblePages" :key="page">
        <a
          class="Pagination__link pagination-link"
          :class="{ 'is-current': page === currentPage }"
          :title="page"
          @click="setPage($event.target.title)"
        >
          {{ page }}
        </a>
      </li>

      <template v-if="showLastPage">
        <li v-show="showRightEllipsis">
          <span class="Pagination__ellipsis pagination-ellipsis">&hellip;</span>
        </li>
        <li>
            <a
              class="Pagination__link pagination-link"
              :title="lastPage"
              @click="setPage($event.target.title)"
            >
              {{ lastPage }}
            </a>
        </li>
      </template>
    </ul>
  </nav>
</template>

<script>
import modifiers from '../utils/modifiers';

export default {
  name: 'pagination',
  props: {
    /**
     * The currently selected page.
     */
    currentPage: {
      type: Number,
      required: true,
    },

    /**
     * The number of items per page.
     */
    pageSize: Number,

    /**
     * The total number of items being paginated.
     */
    totalItems: Number,

    /**
     * The number of pages to pad the current page.
     */
    padding: {
      type: Number,
      default: 3,
    },

    /**
     * Determines whether to show next/previous buttons or not.
     */
    hasButtons: {
      type: Boolean,
      default: true,
    },

    /**
     * Bulma-specific options.
     */
    ...modifiers.props([...modifiers.sizes, ...modifiers.alignments]),
  },
  computed: {
    modifiers() {
      return modifiers.generate([...modifiers.sizes, ...modifiers.alignments], this.$props);
    },
    lastPage() {
      return Math.ceil(this.totalItems / this.pageSize);
    },
    visiblePagesCount() {
      return Math.min((this.padding * 2) + 1, this.lastPage);
    },
    hasNextPage() {
      return this.currentPage < this.lastPage || !this.totalItems;
    },
    hasPreviousPage() {
      return this.currentPage > 1;
    },
{'fraction_non_alphanumeric': 0.14252100840336135, 'fraction_numerical': 0.0020168067226890756, 'mean_word_length': 1.779542269967305, 'pattern_counts': {'":': 0, '<': 79, '<?xml version=': 0, '>': 79, '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': '3687118', 'n_tokens_mistral': 1808, 'n_tokens_neox': 1795, 'n_words': 356}