<commit_before><?php include "conf.php"; /* load a local configuration */ ?>
<?php include "modulekit/loader.php"; /* loads all php-includes */ ?>
<?php call_hooks("init"); ?>
<?php Header("content-type: text/html; charset=utf-8"); ?>
<?php
$max_list = 30;
html_export_var(array("table_def" => $table_def, "max_list" => $max_list));
?>
<!DOCTYPE html>
<html>
  <head>
    <title>Baumkataster Wien</title>
    <?php print modulekit_to_javascript(); /* pass modulekit configuration to JavaScript */ ?>
    <?php print modulekit_include_js(); /* prints all js-includes */ ?>
    <?php print modulekit_include_css(); /* prints all css-includes */ ?>
    <?php print_add_html_headers(); ?>
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
<?php
$db = new PDO("sqlite:data/baum.db");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
include("inc/db.php");

$form_search = new form(null, $form_search_def, array(
    'orig_data' => false,
  ));

$content = "";
if($form_search->is_complete()) {
  $search = $form_search->save_data();
  $form_search->set_orig_data($search);

  $data = get_data($search, $form_search_def);

  if(sizeof($data)) {
    if(sizeof($data) > $max_list) {
      $content .= sprintf("%d Bäume gefunden (%d gelistet):", sizeof($data), $max_list);
    }
    else
      $content .= sprintf("%d Bäume gefunden:", sizeof($data));

    $table = new table($table_def, $data, array(
      'template_engine' => 'twig',
    ));
    $content .= $table->show("html", array(
      "limit" => $max_list,
    ));
  }
  else {
    $content = "Kein Baum gefunden.";
  }
}
else {
  $res = $db->query("select count(*) c from data");
  $elem = $res->fetch();
  $content = "<p>{$elem['c']} Bäume im Baumkataster. Stand: ". Date("d.m.Y", filemtime("data/baum.db"));
}

print "<form id='form_search' method='get'>\n";
print $form_search->show();
print "<input type='submit' value='Suche'>\n";
print "</form>\n";

print "<div id='content'>\n";
print $content;
print "</div>\n";
?>
<p>(cc) <a href='mailto:<EMAIL>'><NAME>-Plepelits</a>, <a href='https://github.com/plepe/baumkataster-wien'>Source Code (Github)</a>
  </body>
</html>
<commit_msg>Re-design front page<commit_after><?php include "conf.php"; /* load a local configuration */ ?>
<?php include "modulekit/loader.php"; /* loads all php-includes */ ?>
<?php call_hooks("init"); ?>
<?php Header("content-type: text/html; charset=utf-8"); ?>
<?php
$max_list = 30;
html_export_var(array("table_def" => $table_def, "max_list" => $max_list));
?>
<!DOCTYPE html>
<html>
  <head>
    <title>Baumkataster Wien</title>
    <?php print modulekit_to_javascript(); /* pass modulekit configuration to JavaScript */ ?>
    <?php print modulekit_include_js(); /* prints all js-includes */ ?>
    <?php print modulekit_include_css(); /* prints all css-includes */ ?>
    <?php print_add_html_headers(); ?>
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
<?php
$db = new PDO("sqlite:data/baum.db");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
include("inc/db.php");

$form_search = new form(null, $form_search_def, array(
    'orig_data' => false,
  ));

$content = "";
if($form_search->is_complete()) {
  $search = $form_search->save_data();
  $form_search->set_orig_data($search);

  $data = get_data($search, $form_search_def);

  if(sizeof($data)) {
    if(sizeof($data) > $max_list) {
      $content .= sprintf("%d Bäume gefunden (%d gelistet):", sizeof($data), $max_list);
    }
    else
      $content .= sprintf("%d Bäume gefunden:", sizeof($data));

    $table = new table($table_def, $data, array(
      'template_engine' => 'twig',
    ));
    $content .= $table->show("html", array(
      "limit" => $max_list,
    ));
  }
  else {
    $content = "Kein Baum gefunden.";
  }
}
else {
  $content = "Bitte Baumnummer angeben oder auf Erkennung Deiner Position warten.";
}

print "<form id='form_search' method='get'>\n";
print $form_search->show();
print "<input type='submit' value='Suche'>\n";
print "</form><hr>\n";

print "<div id='content'>\n";
print $content;
print "</div>\n";
?>
<hr>
<?php
$res = $db->query("select count(*) c from data");
$elem = $res->fetch();
print "{$elem['c']} Bäume im Baumkataster. Stand: ". Date("d.m.Y", filemtime("data/baum.db"));
?>
<br>
(cc) <a href='mailto:<EMAIL>'><NAME>pelits</a>, <a href='https://github.com/plepe/baumkataster-wien'>Source Code (Github)</a>
  </body>
</html>

{'fraction_non_alphanumeric': 0.21392926882187024, 'fraction_numerical': 0.0017357344326318074, 'mean_word_length': 4.621951219512195, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 101, 'https://': 2, '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': '1236339', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1663, 'n_words': 341}