<commit_before>/* global apx */
window.apx = window.apx||{};

/* global empty */
/* global op */

///////////////////////////////////////////////////////////////////////////////
apx.allDocs = {};
apx.allItemsHash = {};

// a simple jquery plugin to sanitize data
(function($) {
    $.sanitize = function(input) {
        var output = input.replace(/<script[^>]*?>.*?<\/script>/gi, '').
            replace(/<[\/\!]*?[^<>]*?>/gi, '');
        return output;
    };
})(jQuery);

/**
 * Class for representing/manipulating/using a document
 *
 * @class
 */
function apxDocument(initializer) {
    var self = this;

    // record the initializer for use when the document is loaded
    self.initializer = initializer;

    // keep track of the current association group chosen for the document, which could be different on sides 1 (left) and 2 (right)
    self.currentAssocGroup = null;
    self.currentAssocGroup2 = null;
    self.setCurrentAssocGroup = function(assocGroup, side) {
        var $agm;
        if (empty(side) || side == 1) {
            self.currentAssocGroup = assocGroup;
            $agm = self.$assocGroupMenu;
        } else {
            self.currentAssocGroup2 = assocGroup;
            $agm = self.$assocGroupMenu2;
        }
<commit_msg>Replace the old sanitization code with Daves code which escapes the values instead of stripping them.<commit_after>/* global apx */
window.apx = window.apx||{};

/* global empty */
/* global op */

///////////////////////////////////////////////////////////////////////////////
apx.allDocs = {};
apx.allItemsHash = {};

var entityMap = {
  '&': '&amp;',
  '<': '&lt;',
  '>': '&gt;',
  '"': '&quot;',
  "'": '&#39;',
  '/': '&#x2F;',
  '`': '&#x60;',
  '=': '&#x3D;'
};

// a simple jquery plugin to sanitize data
(function($) {
    $.sanitize = function(string) {
        return String(string).replace(/[&<>"'`=\/]/g, function (s) {
          return entityMap[s];
        });
    };
})(jQuery);

/**
 * Class for representing/manipulating/using a document
 *
 * @class
 */
function apxDocument(initializer) {
    var self = this;

    // record the initializer for use when the document is loaded
    self.initializer = initializer;

    // keep track of the current association group chosen for the document, which could be different on sides 1 (left) and 2 (right)
    self.currentAssocGroup = null;
    self.currentAssocGroup2 = null;
    self.setCurrentAssocGroup = function(assocGroup, side) {
        var $agm;
        if (empty(side) || side == 1) {
            self.currentAssocGroup = assocGroup;
            $agm = self.$assocGroupMenu;
        } else {
            self.currentAssocGroup2 = assocGroup;
            $agm = self.$assocGroupMenu2;
        }

{'fraction_non_alphanumeric': 0.20616287600880412, 'fraction_numerical': 0.006603081438004402, 'mean_word_length': 2.1344827586206896, 'pattern_counts': {'":': 1, '<': 9, '<?xml version=': 0, '>': 10, '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': '3396261', 'n_tokens_mistral': 842, 'n_tokens_neox': 813, 'n_words': 215}