<commit_before>﻿pagingController = function () {
    var //Support 
        isLoading = false,
        wireListeners = function() { 
            pubsub.subscribe('action.plugin.active', function(subject, payload) { refresh(payload); }); 
        },
/*(import:glimpse.paging.engine.js|2)*/,
        refresh = function (key) {  
            var pagingInfo = data.currentMetadata().plugins[key].pagingInfo; 
            if (pagingInfo) {
                var panelItem = elements.findPanel(key);
                removePreviousPager(key, panelItem); 
                renderPager(key, panelItem, pagingInfo);
            }
        },
        removePreviousPager = function (key, panelItem) {
            var previousPager = panelItem.find('.glimpse-pager-' + key);
            previousPager.remove();
        },
        renderPager = function (key, panelItem, pagingInfo) {
            var pageIndex = parseInt(pagingInfo.pageIndex),
                pageIndexLast = Math.floor((parseInt(pagingInfo.totalNumberOfRecords) - 1) / parseInt(pagingInfo.pageSize));

            if (pageIndex <= pageIndexLast) { 
                var pagerContainer = $('<div class="glimpse-pager glimpse-pager-' + key + '"></div>'),
                    pagerType = pagingInfo.pagerType,
                    pagerEngine = pagingEngine.retrieve(pagerType);<commit_msg>Fixed bug in paging code when metadata isn't available<commit_after>﻿pagingController = function () {
    var //Support 
        isLoading = false,
        wireListeners = function() { 
            pubsub.subscribe('action.plugin.active', function(subject, payload) { refresh(payload); }); 
        },
/*(import:glimpse.paging.engine.js|2)*/,
        refresh = function (key) {  
            if (data.currentMetadata().plugins[key]) {
                var pagingInfo = data.currentMetadata().plugins[key].pagingInfo; 
                if (pagingInfo) {
                    var panelItem = elements.findPanel(key);
                    removePreviousPager(key, panelItem); 
                    renderPager(key, panelItem, pagingInfo);
                }
            }
        },
        removePreviousPager = function (key, panelItem) {
            var previousPager = panelItem.find('.glimpse-pager-' + key);
            previousPager.remove();
        },
        renderPager = function (key, panelItem, pagingInfo) {
            var pageIndex = parseInt(pagingInfo.pageIndex),
                pageIndexLast = Math.floor((parseInt(pagingInfo.totalNumberOfRecords) - 1) / parseInt(pagingInfo.pageSize));

            if (pageIndex <= pageIndexLast) { 
                var pagerContainer = $('<div class="glimpse-pager glimpse-pager-' + key + '"></div>'),
                    pagerType = pagingInfo.pagerType,
                    pagerEngine = pagingEngine.retrieve(pagerType);
{'fraction_non_alphanumeric': 0.12001424501424501, 'fraction_numerical': 0.0014245014245014246, 'mean_word_length': 2.103867403314917, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '823174', 'n_tokens_mistral': 776, 'n_tokens_neox': 755, 'n_words': 137}