<commit_before><?php
/**
 * Returns the link of a declaration from it's ID in the people_declarations
 * table.
 *
 * @param $declarationId
 * @return {String} The link.
 */
function getDeclarationLink($declarationId) {
  $sql = "SELECT source FROM people_declarations WHERE id=${declarationId}";
  $s = mysql_query($sql);
  if ($r = mysql_fetch_array($s)) {
    return $r['source'];
  }
  return NULL;
}


function getPersonId($declarationId) {
  $sql = "SELECT idperson FROM people_declarations WHERE id=${declarationId}";
  $s = mysql_query($sql);
  if ($r = mysql_fetch_array($s)) {
    return $r['idperson'];
  }
  return NULL;
}


/**
 * Used to show the most recent highlighted passages on the front page.
 * @return {Array}
 */
function getMostRecentDeclarations() {
  $sql = "
      SELECT h.source, h.content, d.time, p.display_name, p.id AS idperson,
          p.name
      FROM people_declarations_highlights AS h
      LEFT JOIN people_declarations AS d ON d.source = h.source
      LEFT JOIN people AS p ON d.idperson = p.id
      ORDER BY h.id DESC
      LIMIT 0, 5";
  $s = mysql_query($sql);
  $results = array();
  while ($r = mysql_fetch_array($s)) {
    $r['name'] = str_replace(' ', '+', $r['name']);
    $results[] = $r;
  }
  return $results;
}


function searchDeclarations($query) {
  $sql = "
      SELECT d.id, d.source, d.declaration, d.time, count(*) as cnt,
          people.display_name, people.name, d.idperson
      FROM people_declarations AS d
      LEFT JOIN people ON people.id = d.idperson
      WHERE d.declaration LIKE '%{$query}%'
      GROUP BY d.idperson
      ORDER BY cnt DESC
      LIMIT 0, 20";

  $s = mysql_query($sql);
  $results = array();
  while ($r = mysql_fetch_array($s)) {<commit_msg>Small fix to declarations<commit_after><?php
/**
 * Returns the link of a declaration from it's ID in the people_declarations
 * table.
 *
 * @param $declarationId
 * @return {String} The link.
 */
function getDeclarationLink($declarationId) {
  $sql = "SELECT source FROM people_declarations WHERE id=${declarationId}";
  $s = mysql_query($sql);
  if ($r = mysql_fetch_array($s)) {
    return $r['source'];
  }
  return NULL;
}


function getPersonId($declarationId) {
  $sql = "SELECT idperson FROM people_declarations WHERE id=${declarationId}";
  $s = mysql_query($sql);
  if ($r = mysql_fetch_array($s)) {
    return $r['idperson'];
  }
  return NULL;
}


/**
 * Used to show the most recent highlighted passages on the front page.
 * @return {Array}
 */
function getMostRecentDeclarations() {
  $sql = "
      SELECT h.source, h.content, d.time, p.display_name, p.id AS idperson,
          p.name
      FROM people_declarations_highlights AS h
      LEFT JOIN people_declarations AS d ON d.source = h.source
      LEFT JOIN people AS p ON d.idperson = p.id
      ORDER BY h.id DESC
      LIMIT 0, 5";
  $s = mysql_query($sql);
  $results = array();
  while ($r = mysql_fetch_array($s)) {
    $r['name'] = str_replace(' ', '+', $r['name']);
    $r['content'] = stripslashes($r['content']);
    $results[] = $r;
  }
  return $results;
}


function searchDeclarations($query) {
  $sql = "
      SELECT d.id, d.source, d.declaration, d.time, count(*) as cnt,
          people.display_name, people.name, d.idperson
      FROM people_declarations AS d
      LEFT JOIN people ON people.id = d.idperson
      WHERE d.declaration LIKE '%{$query}%'
      GROUP BY d.idperson
      ORDER BY cnt DESC
      LIMIT 0, 20";

  $s = mysql_query($sql);
  $results = array();
  while ($r = mysql_fetch_array($s)) {
{'fraction_non_alphanumeric': 0.13999435506632796, 'fraction_numerical': 0.002822466836014677, 'mean_word_length': 3.2240762812872465, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7298834', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1183, 'n_words': 341}