<commit_before>/*
 * Based on simplePagination - Copyright (c) 2012 <NAME> - http://flaviusmatis.github.com/simplePagination.js/ (MIT)
 */
(function(addon) {

    if (typeof define == "function" && define.amd) { // AMD
        define("uikit-pagination", ["uikit"], function(){
            return jQuery.UIkit.pagination || addon(window, window.jQuery, window.jQuery.UIkit);
        });
    }

    if(window && window.jQuery && window.jQuery.UIkit) {
        addon(window, window.jQuery, window.jQuery.UIkit);
    }

})(function(global, $, UI){

    "use strict";

    var Pagination = function(element, options) {

        var $element = $(element), $this = this;

        if ($element.data("pagination")) return;

        this.element       = $element;
        this.options       = $.extend({}, Pagination.defaults, options);
        this.pages         = this.options.pages ?  this.options.pages : Math.ceil(this.options.items / this.options.itemsOnPage) ? Math.ceil(this.options.items / this.options.itemsOnPage) : 1;
        this.currentPage   = this.options.currentPage - 1;
        this.halfDisplayed = this.options.displayedPages / 2;

        $element.data("pagination", this).on("click", "a[data-page]", function(e){

            e.preventDefault();

            var page = $(this).data("page");

            $this.selectPage(page);
            $this.options.onSelectPage.apply($this, [page]);
            $this.element.trigger('uk-select-page', [page, $this]);
        });

        this._render();
    };


    $.extend(Pagination.prototype, {

        _getInterval: function() {

            return {
                start: Math.ceil(this.currentPage > this.halfDisplayed ? Math.max(Math.min(this.currentPage - this.halfDisplayed, (this.pages - this.options.displayedPages)), 0) : 0),
                end  : Math.ceil(this.currentPage > this.halfDisplayed ? Math.min(this.currentPage + this.halfDisplayed, this.pages) : Math.min(this.options.displayedPages, this.pages))
            };
        },

        render: function(pages) {
            this.pages = pages ? pages : this.pages;
            this._render();
        },

        selectPage: function(pageIndex) {
            this.currentPage = pageIndex;
            this._render();
        },

        _render: function() {
<commit_msg>pagination add-on updated<commit_after>/*
 * Based on simplePagination - Copyright (c) 2012 <NAME> - http://flaviusmatis.github.com/simplePagination.js/ (MIT)
 */
(function(addon) {

    if (typeof define == "function" && define.amd) { // AMD
        define("uikit-pagination", ["uikit"], function(){
            return jQuery.UIkit.pagination || addon(window, window.jQuery, window.jQuery.UIkit);
        });
    }

    if(window && window.jQuery && window.jQuery.UIkit) {
        addon(window, window.jQuery, window.jQuery.UIkit);
    }

})(function(global, $, UI){

    "use strict";

    var Pagination = function(element, options) {

        var $element = $(element), $this = this;

        if ($element.data("pagination")) return;

        this.element       = $element;
        this.options       = $.extend({}, Pagination.defaults, options);
        this.pages         = this.options.pages ?  this.options.pages : Math.ceil(this.options.items / this.options.itemsOnPage) ? Math.ceil(this.options.items / this.options.itemsOnPage) : 1;
        this.currentPage   = this.options.currentPage - 1;
        this.halfDisplayed = this.options.displayedPages / 2;

        $element.data("pagination", this).on("click", "a[data-page]", function(e){

            e.preventDefault();

            var page = $(this).data("page");

            $this.selectPage(page);
        });

        this._render();
    };


    $.extend(Pagination.prototype, {

        _getInterval: function() {

            return {
                start: Math.ceil(this.currentPage > this.halfDisplayed ? Math.max(Math.min(this.currentPage - this.halfDisplayed, (this.pages - this.options.displayedPages)), 0) : 0),
                end  : Math.ceil(this.currentPage > this.halfDisplayed ? Math.min(this.currentPage + this.halfDisplayed, this.pages) : Math.min(this.options.displayedPages, this.pages))
            };
        },

        render: function(pages) {
            this.pages = pages ? pages : this.pages;
            this._render();
        },

        selectPage: function(pageIndex, pages) {
            this.currentPage = pageIndex;
            this.render(pages);

            this.options.onSelectPage.apply($this, [page]);
            this.element.trigger('uk-select-page', [page, $this]);
        },

        _render: function() {

{'fraction_non_alphanumeric': 0.1522491349480969, 'fraction_numerical': 0.0038927335640138406, 'mean_word_length': 2.327338129496403, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2105475', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1341, 'n_words': 237}