<commit_before><?php

function getPlayerName($guid)
{
  global $db;

  $query = sprintf("SELECT name FROM characters WHERE guid = %d;", $guid);
  $row = $db->query($query)->fetch_array();

  return $row['name'];
}

function getPlayerColor($guid)
{
  global $db, $alliance_color, $horde_color;

  $query = sprintf("SELECT race FROM characters WHERE guid = %s", $guid);
  $row = $db->query($query)->fetch_row();

  switch ($row[0])
  {
    case 1:
    case 3:
    case 4:
    case 7:
    case 11:
      $color = $alliance_color;
      break;
    case 2:
    case 5:
    case 6:
    case 8:
    case 10:
      $color = $horde_color;
      break;
  }

  return $color;
}

function getFactionScores($time_cond, $level_cond)
{
  global $db, $ALLIANCE, $HORDE;

  $score[2];

  if ($time_cond != "")
    $time_cond = "AND " . $time_cond;

  if ($level_cond != "")
    $level_cond = "AND " . $level_cond;

  $query = sprintf("SELECT COUNT(*) FROM pvpstats_faction WHERE faction = %d %s %s UNION SELECT COUNT(*) FROM pvpstats_faction WHERE faction = %d %s %s;",
                   $ALLIANCE, $time_cond, $level_cond, $HORDE, $time_cond, $level_cond);

  $result = $db->query($query);

  $row = $result->fetch_row();
  $score[0] = $row[0];

  $row = $result->fetch_row();

  if ($row != null)
    $score[1] = $row[0];
  else
    $score[1] = 0;

  return $score;
}

function getPlayersScores($time_cond, $level_cond)
{
  global $db, $limit, $players_group_and_order, $amory_url;


  if ($time_cond == "" && $level_cond == "")
    $where = "";
  else
    $where = "WHERE";

  if ($time_cond != "" && $level_cond != "")
    $level_cond = "AND " . $level_cond;
<commit_msg>fix bug in function getFactionScores<commit_after><?php

function getPlayerName($guid)
{
  global $db;

  $query = sprintf("SELECT name FROM characters WHERE guid = %d;", $guid);
  $row = $db->query($query)->fetch_array();

  return $row['name'];
}

function getPlayerColor($guid)
{
  global $db, $alliance_color, $horde_color;

  $query = sprintf("SELECT race FROM characters WHERE guid = %s", $guid);
  $row = $db->query($query)->fetch_row();

  switch ($row[0])
  {
    case 1:
    case 3:
    case 4:
    case 7:
    case 11:
      $color = $alliance_color;
      break;
    case 2:
    case 5:
    case 6:
    case 8:
    case 10:
      $color = $horde_color;
      break;
  }

  return $color;
}

function getFactionScores($time_cond, $level_cond)
{
  global $db, $ALLIANCE, $HORDE;

  $score[2];

  if ($time_cond != "")
    $time_cond = "AND " . $time_cond;

  if ($level_cond != "")
    $level_cond = "AND " . $level_cond;

  $query = sprintf("SELECT COUNT(*) FROM pvpstats_faction WHERE faction = %d %s %s UNION SELECT COUNT(*) FROM pvpstats_faction WHERE faction = %d %s %s;",
                   $ALLIANCE, $time_cond, $level_cond, $HORDE, $time_cond, $level_cond);

  $result = $db->query($query);

  $row = $result->fetch_row();
  $score[0] = $row[0];

  $row = $result->fetch_row();

  if ($row != null)
    $score[1] = $row[0];
  else
    $score[1] = $score[0];

  return $score;
}

function getPlayersScores($time_cond, $level_cond)
{
  global $db, $limit, $players_group_and_order, $amory_url;


  if ($time_cond == "" && $level_cond == "")
    $where = "";
  else
    $where = "WHERE";

  if ($time_cond != "" && $level_cond != "")
    $level_cond = "AND " . $level_cond;

{'fraction_non_alphanumeric': 0.17885936100328456, 'fraction_numerical': 0.011943863839952225, 'mean_word_length': 3.1927409261576973, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '1819133', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1253, 'n_words': 300}