<commit_before><?php

require dirname(__DIR__) . '/config.php';

if (!array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' ||
    !array_key_exists('username', $_SESSION)) {
    header("HTTP/1.0 400 Bad Request");
    exit(0);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, URL_QUICKVIEW);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_COOKIEFILE, $_SESSION['cookie']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$content = curl_exec($ch);
if (!$content) {
    renderAjax(array('success' => false, 'message' => 'Request error: ' . curl_error($ch)));
}
curl_close($ch);

if(!preg_match_all('#<li>\s*<img src="[https?://www.geocaching.com]?/images/wpttypes/sm/[a-z0-9]+.gif" width="16" height="16" alt="" />' .
                  '\s*<a href="https?://www.geocaching.com/seek/cache_details.aspx\?guid=(.*)">(.*)</a>[\s+]?</li>#msU', $content, $elements)) {
    renderAjax(array('success' => false, 'message' => 'No unpublished caches found.'));
}
$unpublishedCaches = array_map('trim', array_combine($elements[1], $elements[2]));

if (empty($unpublishedCaches)) {
    renderAjax(array('success' => false, 'message' => 'Problem during recovery unpublished caches'));
}

renderAjax(array('success' => true, 'unpublishedCaches' => $unpublishedCaches));
<commit_msg>Updated timeout for curl requests<commit_after><?php

require dirname(__DIR__) . '/config.php';

if (!array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' ||
    !array_key_exists('username', $_SESSION)) {
    header("HTTP/1.0 400 Bad Request");
    exit(0);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, URL_QUICKVIEW);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_COOKIEFILE, $_SESSION['cookie']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$content = curl_exec($ch);
if (!$content) {
    renderAjax(array('success' => false, 'message' => 'Request error: ' . curl_error($ch)));
}
curl_close($ch);

if(!preg_match_all('#<li>\s*<img src="[https?://www.geocaching.com]?/images/wpttypes/sm/[a-z0-9]+.gif" width="16" height="16" alt="" />' .
                  '\s*<a href="https?://www.geocaching.com/seek/cache_details.aspx\?guid=(.*)">(.*)</a>[\s+]?</li>#msU', $content, $elements)) {
    renderAjax(array('success' => false, 'message' => 'No unpublished caches found.'));
}
$unpublishedCaches = array_map('trim', array_combine($elements[1], $elements[2]));

if (empty($unpublishedCaches)) {
    renderAjax(array('success' => false, 'message' => 'Problem during recovery unpublished caches'));
}

renderAjax(array('success' => true, 'unpublishedCaches' => $unpublishedCaches));

{'fraction_non_alphanumeric': 0.2074966532797858, 'fraction_numerical': 0.012048192771084338, 'mean_word_length': 6.6055979643765905, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2183010', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1076, 'n_words': 172}