<commit_before><?php

$title = empty($_GET['title']) ? '' : $_GET['title'];
$uri = empty($_GET['uri']) ? '' : $_GET['uri'];
$tags = empty($_GET['tags']) ? '' : $_GET['tags'];

if ($title && $uri) {
  require __DIR__ . '/../src/LoadClasses.php';
  $factory = new \Foxtrap\Factory();
  $now = time();
  $mark = [
    'title' => $title,
    'uri' => $uri,
    'tags' => $tags
  ];
  $mark = array_map('stripslashes', $mark);
  $mark['hash'] = md5($mark['uri']);
  $mark['modified'] = $now;
  $mark['added'] = $now;
  $mark['last_err'] = '';
  $lastInsertId = $factory->createInstance()->getDb()->register($mark);
}

$foxtrap->jsonpHeader();
echo $foxtrap->jsonpCallback(json_encode($lastInsertId), $_GET['callback']);<commit_msg>FIX undefined variable<commit_after><?php

$title = empty($_POST['title']) ? '' : $_POST['title'];
$uri = empty($_POST['uri']) ? '' : $_POST['uri'];
$tags = empty($_POST['tags']) ? '' : $_POST['tags'];

if ($title && $uri) {
  require __DIR__ . '/../src/LoadClasses.php';
  $factory = new \Foxtrap\Factory();
  $now = time();
  $mark = [
    'title' => $title,
    'uri' => $uri,
    'tags' => $tags
  ];
  $mark = array_map('stripslashes', $mark);
  $mark['hash'] = md5($mark['uri']);
  $mark['modified'] = $now;
  $mark['added'] = $now;
  $mark['last_err'] = '';
  $lastInsertId = $factory->createInstance()->getDb()->register($mark);
}

$foxtrap = $factory->createInstance();
$foxtrap->jsonpHeader();
echo $foxtrap->jsonpCallback(json_encode($lastInsertId), $_GET['callback']);
{'fraction_non_alphanumeric': 0.27091633466135456, 'fraction_numerical': 0.0013280212483399733, 'mean_word_length': 4.863813229571984, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '1151953', 'n_tokens_mistral': 551, 'n_tokens_neox': 550, 'n_words': 91}