<commit_before><?php

require_once 'classes/event.class.php';
require_once 'classes/news.class.php';
require_once 'classes/note.class.php';
require_once 'classes/category.class.php';
require_once 'classes/subject.class.php';
require_once 'classes/user.class.php';

$index_var['location'][] = array('url' => '/news/', 'name' => 'Hírek');

$index_var['title'] = 'Hírek';

$news = array();

try {

  $getNewsData = $con->query('
    select id
    from news
    where live = 1
    order by date desc
  ');

} catch (PDOException $e) {
  die($config['errors']['database']);
}

while ($newsData = $getNewsData->fetch()) {

  $new = new news($newsData['id']);
  $a = $new->getData();

  $author = new user($new->getData()['creatorid']);
  $a['creator'] = $author->getData()['name'];

  $news[] = $a;

}

$current_events = array();

try {

  $getCurrentEvents = $con->query('
    select id
    from events
    where startdate <= now() and enddate >= now()
    order by startdate asc
    limit 0, 5
  ');

} catch (PDOException $e) {
  die($config['errors']['database']);
}

while ($eventData = $getCurrentEvents->fetch()) {

  $event = new event($eventData['id']);
  $current_events[] = $event->getData();

}

$upcoming_events = array();

try {

  $getUpcomingEvents = $con->query('
    select id
    from events
    where startdate >= now()
    order by startdate asc
    limit 0, 5
  ');

} catch (PDOException $e) {
  die($config['errors']['database']);
}

while ($eventData = $getUpcomingEvents->fetch()) {

  $event = new event($eventData['id']);
  $upcoming_events[] = $event->getData();

}

$recentNotes = array();

try {

  $getNotes = $con->query('
    select id
    from notes
    order by updatedate desc
    limit 5
  ');

} catch (PDOException $e) {
  die($config['errors']['database']);
}

while ($foundNote = $getNotes->fetch()) {

  $note = new note($foundNote['id']);
  $noteData = $note->getData();

  $subject = new subject($noteData['subjectid']);
  $category = new category($noteData['category']);<commit_msg>Only display live notes on the front page<commit_after><?php

require_once 'classes/event.class.php';
require_once 'classes/news.class.php';
require_once 'classes/note.class.php';
require_once 'classes/category.class.php';
require_once 'classes/subject.class.php';
require_once 'classes/user.class.php';

$index_var['location'][] = array('url' => '/news/', 'name' => 'Hírek');

$index_var['title'] = 'Hírek';

$news = array();

try {

  $getNewsData = $con->query('
    select id
    from news
    where live = 1
    order by date desc
  ');

} catch (PDOException $e) {
  die($config['errors']['database']);
}

while ($newsData = $getNewsData->fetch()) {

  $new = new news($newsData['id']);
  $a = $new->getData();

  $author = new user($new->getData()['creatorid']);
  $a['creator'] = $author->getData()['name'];

  $news[] = $a;

}

$current_events = array();

try {

  $getCurrentEvents = $con->query('
    select id
    from events
    where startdate <= now() and enddate >= now()
    order by startdate asc
    limit 0, 5
  ');

} catch (PDOException $e) {
  die($config['errors']['database']);
}

while ($eventData = $getCurrentEvents->fetch()) {

  $event = new event($eventData['id']);
  $current_events[] = $event->getData();

}

$upcoming_events = array();

try {

  $getUpcomingEvents = $con->query('
    select id
    from events
    where startdate >= now()
    order by startdate asc
    limit 0, 5
  ');

} catch (PDOException $e) {
  die($config['errors']['database']);
}

while ($eventData = $getUpcomingEvents->fetch()) {

  $event = new event($eventData['id']);
  $upcoming_events[] = $event->getData();

}

$recentNotes = array();

try {

  $getNotes = $con->query('
    select id
    from notes
    where live = 1
    order by updatedate desc
    limit 5
  ');

} catch (PDOException $e) {
  die($config['errors']['database']);
}

while ($foundNote = $getNotes->fetch()) {

  $note = new note($foundNote['id']);
  $noteData = $note->getData();

  $subject = new subject($noteData['subjectid']);
  $category = new category($noteData['category']);
{'fraction_non_alphanumeric': 0.19677340503544366, 'fraction_numerical': 0.0031777071620630653, 'mean_word_length': 4.002444987775061, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 39, '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': '2913701', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1387, 'n_words': 315}