<commit_before><?
// sample graph

   require("./include/common.php");
   require("./include/freshports.php");
   require("./include/databaselogin.php");

#require( "./include/commonlogin.php3");
#require( "./include/getvalues.php3");

$MaxGraph = 3;

if (!isset($graph)) {
   $graph = 1;
} else {
   if ($graph < 1 or $graph > $MaxGraph) {
      $graph = 1;
   }
}

switch ($graph) {
   case 1:
      $cache_file .= ".top.watched.ports";
      break;

   case 2:
      $cache_file .= ".top.committers";
      break;

   case 3:
      $cache_file .= ".top.biggest.commits";
      break;
}

$CreateImage = 0;
if (!file_exists($cache_file)) {
//   echo 'cache does not exist<br>';
   // cache does not exist, we create it
   $CreateImage = 1;
} else {
/*
   echo "filectime  = " . filectime($cache_file) . "<br>";
   echo "filectime+ = " . (filectime($cache_file) + $cache_time_rnd + 24*60*60) . "<br>";
   echo "time()     = " . time();
*/
   if ((filectime($cache_file) + $cache_time_rnd + 24*60*60) < time()) {
      $CreateImage = 1;
   }
}

$CreateImage = 1;
if ($CreateImage) {
   require("./_phpgraph/phpgraph.php");
   require("./include/statistics.php3");
   switch ($graph) {
      case 1:
         $data = freshports_stats_watched_ports($db, 20);
         freshports_DrawGraph($data, "Top 20 Most Watched Ports", 500, 475, $cache_file);
         break;

      case 2:
         $data = freshports_stats_committers($db, 20);
         freshports_DrawGraph($data, "Top 20 Committers - number of commits", 500, 475, $cache_file); 
         break;

      case 3:<commit_msg>change file extension<commit_after><?
// sample graph

   require("./include/common.php");
   require("./include/freshports.php");
   require("./include/databaselogin.php");

#require( "./include/commonlogin.php3");
#require( "./include/getvalues.php3");

$MaxGraph = 3;

if (!isset($graph)) {
   $graph = 1;
} else {
   if ($graph < 1 or $graph > $MaxGraph) {
      $graph = 1;
   }
}

switch ($graph) {
   case 1:
      $cache_file .= ".top.watched.ports";
      break;

   case 2:
      $cache_file .= ".top.committers";
      break;

   case 3:
      $cache_file .= ".top.biggest.commits";
      break;
}

$CreateImage = 0;
if (!file_exists($cache_file)) {
//   echo 'cache does not exist<br>';
   // cache does not exist, we create it
   $CreateImage = 1;
} else {
/*
   echo "filectime  = " . filectime($cache_file) . "<br>";
   echo "filectime+ = " . (filectime($cache_file) + $cache_time_rnd + 24*60*60) . "<br>";
   echo "time()     = " . time();
*/
   if ((filectime($cache_file) + $cache_time_rnd + 24*60*60) < time()) {
      $CreateImage = 1;
   }
}

$CreateImage = 1;
if ($CreateImage) {
   require("./_phpgraph/phpgraph.php");
   require("./include/statistics.php");
   switch ($graph) {
      case 1:
         $data = freshports_stats_watched_ports($db, 20);
         freshports_DrawGraph($data, "Top 20 Most Watched Ports", 500, 475, $cache_file);
         break;

      case 2:
         $data = freshports_stats_committers($db, 20);
         freshports_DrawGraph($data, "Top 20 Committers - number of commits", 500, 475, $cache_file); 
         break;

      case 3:
{'fraction_non_alphanumeric': 0.17905726036064537, 'fraction_numerical': 0.030686491616577032, 'mean_word_length': 2.7331759149940966, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, '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': '4899013', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1113, 'n_words': 245}