<commit_before><?php
/**
 * Minigitweb - a git web client contained in a single file.
 *
 * Put this file (or a symlink to it) inside a git repository. Then point the browser to it.
 *
 * Note: the webserver must have read permission in the .git directory.
 * For "git status", the webserver must also have write permission, to create a lock file.
 *
 * By Viktor 2011-05-04
 */

// unregister globals
if (ini_get('register_globals')) {
  foreach ($GLOBALS as $k => $v) {
    if ($k !== 'GLOBALS' && $k !== '_GET' && $k !== '_SERVER') unset($GLOBALS[$k]);
  }
}
error_reporting(E_ALL | E_NOTICE);

header("Content-Type: text/html; charset=UTF-8");

// Find directory containing the .git directory
if (isset($_SERVER['REQUEST_METHOD'])) $path = $_SERVER['SCRIPT_FILENAME']; // for web scripts
else $path = getcwd(); // for command line use
while(true) {
  if (file_exists("$path/.git")) break;
  $oldpath = $path;
  $path = dirname($path);
  if ($path == $oldpath) {
    // eternal loop
    trigger_error("Not in a git repository", E_USER_ERROR);
    break;
  }
}

chdir($path);

$repo = basename($path);
$do = $_GET['do'];
if (!$do) $do = 'status';

?>
<!DOCTYPE html>
<html>
  <head>
    <title>git <?= $do . ' @ ' . htmlspecialchars($repo) ?> - minigitweb</title>
    <style>
      /* general stuff */
      input.check   { vertical-align: bottom; margin:0 3px }
      a             { text-decoration: none; }

      /* page elements */
      body          { margin: 0; padding: 0 }
      .header       { background-color: #000; color: #fff; }
      .content      { padding: 0.3em; font-family: monospace; }<commit_msg>Removes an access to an undefined index.<commit_after><?php
/**
 * Minigitweb - a git web client contained in a single file.
 *
 * Put this file (or a symlink to it) inside a git repository. Then point the browser to it.
 *
 * Note: the webserver must have read permission in the .git directory.
 * For "git status", the webserver must also have write permission, to create a lock file.
 *
 * By Viktor 2011-05-04
 */

// unregister globals
if (ini_get('register_globals')) {
  foreach ($GLOBALS as $k => $v) {
    if ($k !== 'GLOBALS' && $k !== '_GET' && $k !== '_SERVER') unset($GLOBALS[$k]);
  }
}
error_reporting(E_ALL | E_NOTICE);

header("Content-Type: text/html; charset=UTF-8");

// Find directory containing the .git directory
if (isset($_SERVER['REQUEST_METHOD'])) $path = $_SERVER['SCRIPT_FILENAME']; // for web scripts
else $path = getcwd(); // for command line use
while(true) {
  if (file_exists("$path/.git")) break;
  $oldpath = $path;
  $path = dirname($path);
  if ($path == $oldpath) {
    // eternal loop
    trigger_error("Not in a git repository", E_USER_ERROR);
    break;
  }
}

chdir($path);

$repo = basename($path);
$do = empty($_GET['do']) ? 'status' : $_GET['do'];

?>
<!DOCTYPE html>
<html>
  <head>
    <title>git <?= $do . ' @ ' . htmlspecialchars($repo) ?> - minigitweb</title>
    <style>
      /* general stuff */
      input.check   { vertical-align: bottom; margin:0 3px }
      a             { text-decoration: none; }

      /* page elements */
      body          { margin: 0; padding: 0 }
      .header       { background-color: #000; color: #fff; }
      .content      { padding: 0.3em; font-family: monospace; }
{'fraction_non_alphanumeric': 0.166412213740458, 'fraction_numerical': 0.01099236641221374, 'mean_word_length': 3.0494437577255873, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '4242971', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1076, 'n_words': 334}