<commit_before>(function() {
  var params = { 
    offset: 0,
    count: 50
  };

  var search = function(query) {
    params.q = query;
    document.location.hash = JSON.stringify(params);
    $("#results").load("/search/ajax", params);
    $("#query").val(params.q);
  };

  $().ready(function() {
    if (location.hash.length > 1) {
      try {
        params = JSON.parse(location.hash.substring(1));
      } catch (e) {
        // Do nothing 
      }
      search(params.q);
    }

    $(window).hashchange(function() {
      params = JSON.parse(location.hash.substring(1));
      query = params.q
      if (query != $("#query").val()) {
        scroll(0, 0); 
        search(query);
      }
    });

    $("a.querychanger").live("click", function() {
      var href = $(this).attr("href");
      var re = new RegExp("[&?]q=([^&]+)");
      var match = re.exec(href);
      if (match) {
        search(match[1]);
      }
      return false;
    });

    $("ul.results li.event").live("click", function() {
      var data = eval($(this).data("full"));

      /* Apply template to the dialog */
      var query = $("#query").val().replace(/^\s+|\s+$/g, "")
      console.log(query)
      var sanitize = function(str) {
        if (!/^".*"$/.test(str)) {
          str = '"' + str + '"';
        }
        return escape(str);
      };
<commit_msg>- urlescape our strings so they're safer (and easier to paste places)<commit_after>(function() {
  var params = { 
    offset: 0,
    count: 50
  };

  var search = function(query) {
    params.q = query;
    document.location.hash = escape(JSON.stringify(params));
    $("#results").load("/search/ajax", params);
    $("#query").val(params.q);
  };

  $().ready(function() {
    if (location.hash.length > 1) {
      try {
        params = JSON.parse(unescape(location.hash.substring(1)));
      } catch (e) {
        // Do nothing 
      }
      search(params.q);
    }

    $(window).hashchange(function() {
      params = JSON.parse(unescape(location.hash.substring(1)));
      query = params.q
      if (query != $("#query").val()) {
        scroll(0, 0); 
        search(query);
      }
    });

    $("a.querychanger").live("click", function() {
      var href = $(this).attr("href");
      var re = new RegExp("[&?]q=([^&]+)");
      var match = re.exec(href);
      if (match) {
        search(match[1]);
      }
      return false;
    });

    $("ul.results li.event").live("click", function() {
      var data = eval($(this).data("full"));

      /* Apply template to the dialog */
      var query = $("#query").val().replace(/^\s+|\s+$/g, "")
      console.log(query)
      var sanitize = function(str) {
        if (!/^".*"$/.test(str)) {
          str = '"' + str + '"';
        }
        return escape(str);
      };

{'fraction_non_alphanumeric': 0.21207764198418405, 'fraction_numerical': 0.006470165348670022, 'mean_word_length': 2.116461366181411, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6581208', 'n_tokens_mistral': 921, 'n_tokens_neox': 895, 'n_words': 173}