<commit_before>// A jQuery plugin for PAging and taILing data (i.e., a
// 'PAILer'). Paging occurs when scrolling reaches the "top" and
// tailing occurs when scrolling has reached the "bottom".

// A 'read' function must be provided for reading the data (in
// bytes). This function should expect an "options" object with the
// fields 'offset' and 'length' set for reading the data. The result
// from of the function should be a "promise" like value which has a
// 'then' and 'fail' callback which each take a function. An
// object with at least two fields defined ('offset' and 'data') is
// expected on success. The length of 'data' may be smaller than the
// amount requested. If the offset requested is greater than the
// available offset, the result should be an object with the 'offset'
// field set to the available offset (i.e., the total length of the
// data) with an empty 'data' field.

// The plugin prepends, appends, and updates the "html" component of
// the elements specified in the jQuery selector (e.g., doing
// $('#data').pailer(...) means that data will be updated within
// $('#data') via $('#data').prepend(...) and $('#data').append(...)
// and $('#data').html(...) calls).

// An indicator paragraph element (i.e., <p>) can be specified that
// the plugin will write text to describing any status/errors that
// have been encountered.

// Data will automagically get truncated at some specified length,
// configurable via the 'truncate-length' option. Likewise, the amount
// of data paged in at a time can be configured via the 'page-size'
// option.

// Example:
//   HTML:
//     <div id="data" style="white-space:pre-wrap;"></div>
//
//     <div style="position: absolute; left: 5px; top: 0px;">
//       <p id="indicator"></p>
//     </div>
//  Javascript:
//    $('#data').pailer({
//      'read': function(options) {
//        var settings = $.extend({
//          'offset': -1,
//          'length': -1
//        }, options);
//        var url = '/url/for/data'
//          + '?offset=' + settings.offset
//          + '&length=' + settings.length;
//        return $.getJSON(url);
//      },
//      'indicator': $('#indicator')
//    });

(function($) {
  'use strict';

  // Helper for escaping html, based on _.escape from underscore.js.
  function escapeHTML(string) {
    if (string == null) {
      return '';
    }

    var escapes = {
      '&': '&amp;',
      '<': '&lt;',
      '>': '&gt;',
      '"': '&quot;',
      "'": '&#x27;',
      '/': '&#x2F;'
    };
    var regex = new RegExp('[' + Object.keys(escapes).join('') + ']', 'g');

    return ('' + string).replace(regex, function (match) {
      return escapes[match];
    });
  }

  function Pailer(read, element, indicator, page_size, truncate_length) {
    var this_ = this;

    this_.read = read;
    this_.element = element;
    this_.indicator = indicator;
    this_.initialized = false;
    this_.start = -1;
    this_.end = -1;
    this_.paging = false;
    this_.tailing = true;

    if (page_size) {
        $.error('Expecting page_size to be defined')
    }

    if (truncate_length) {
        $.error('Expecting truncate_length to be defined')
    }

    this_.page_size = page_size;<commit_msg>Fixed incorrect testing of existence of variables.<commit_after>// A jQuery plugin for PAging and taILing data (i.e., a
// 'PAILer'). Paging occurs when scrolling reaches the "top" and
// tailing occurs when scrolling has reached the "bottom".

// A 'read' function must be provided for reading the data (in
// bytes). This function should expect an "options" object with the
// fields 'offset' and 'length' set for reading the data. The result
// from of the function should be a "promise" like value which has a
// 'then' and 'fail' callback which each take a function. An
// object with at least two fields defined ('offset' and 'data') is
// expected on success. The length of 'data' may be smaller than the
// amount requested. If the offset requested is greater than the
// available offset, the result should be an object with the 'offset'
// field set to the available offset (i.e., the total length of the
// data) with an empty 'data' field.

// The plugin prepends, appends, and updates the "html" component of
// the elements specified in the jQuery selector (e.g., doing
// $('#data').pailer(...) means that data will be updated within
// $('#data') via $('#data').prepend(...) and $('#data').append(...)
// and $('#data').html(...) calls).

// An indicator paragraph element (i.e., <p>) can be specified that
// the plugin will write text to describing any status/errors that
// have been encountered.

// Data will automagically get truncated at some specified length,
// configurable via the 'truncate-length' option. Likewise, the amount
// of data paged in at a time can be configured via the 'page-size'
// option.

// Example:
//   HTML:
//     <div id="data" style="white-space:pre-wrap;"></div>
//
//     <div style="position: absolute; left: 5px; top: 0px;">
//       <p id="indicator"></p>
//     </div>
//  Javascript:
//    $('#data').pailer({
//      'read': function(options) {
//        var settings = $.extend({
//          'offset': -1,
//          'length': -1
//        }, options);
//        var url = '/url/for/data'
//          + '?offset=' + settings.offset
//          + '&length=' + settings.length;
//        return $.getJSON(url);
//      },
//      'indicator': $('#indicator')
//    });

(function($) {
  'use strict';

  // Helper for escaping html, based on _.escape from underscore.js.
  function escapeHTML(string) {
    if (string == null) {
      return '';
    }

    var escapes = {
      '&': '&amp;',
      '<': '&lt;',
      '>': '&gt;',
      '"': '&quot;',
      "'": '&#x27;',
      '/': '&#x2F;'
    };
    var regex = new RegExp('[' + Object.keys(escapes).join('') + ']', 'g');

    return ('' + string).replace(regex, function (match) {
      return escapes[match];
    });
  }

  function Pailer(read, element, indicator, page_size, truncate_length) {
    var this_ = this;

    this_.read = read;
    this_.element = element;
    this_.indicator = indicator;
    this_.initialized = false;
    this_.start = -1;
    this_.end = -1;
    this_.paging = false;
    this_.tailing = true;

    if (!page_size) {
        $.error('Expecting page_size to be defined')
    }

    if (!truncate_length) {
        $.error('Expecting truncate_length to be defined')
    }

    this_.page_size = page_size;
{'fraction_non_alphanumeric': 0.16427136454952868, 'fraction_numerical': 0.0027816411682892906, 'mean_word_length': 2.6035634743875278, 'pattern_counts': {'":': 2, '<': 19, '<?xml version=': 0, '>': 19, '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': '6976647', 'n_tokens_mistral': 1977, 'n_tokens_neox': 1931, 'n_words': 707}