<commit_before><?php
	// TWEET NEST
	// Preheader
	
	$startTime = microtime(true);
	
	error_reporting(E_ALL ^ E_NOTICE);
	mb_language("uni");
	mb_internal_encoding("UTF-8");
	
	define("TWEET_NEST", "0.8.3"); // Version number
	
	require "config.php";
	if(empty($config['twitter_screenname'])){ header("Location: ./setup.php"); exit; }
	date_default_timezone_set($config['timezone']);
	define("DTP", $config['db']['table_prefix']);
	
	// Get the full path
	$fPath = explode(DIRECTORY_SEPARATOR, rtrim(__FILE__, DIRECTORY_SEPARATOR));
	array_pop($fPath); array_pop($fPath); // Remove inc/preheader.php
	$fPath = implode($fPath, "/");
	define("FULL_PATH", $fPath);
	
	// SmartyPants
	include "smartypants.php";
	
	// DB
	require "class.db.php";
	$db = new DB("mysql", $config['db']);
	if(!$delayedDB){ unset($config['db']['password']); }
	
	// Twitter API class
	require "class.twitterapi.php";
	$twitterApi = new TwitterApi();
	
	// Search
	require "class.search.php";
	$search = new TweetNestSearch();
	
	// Outputting various generic parts
	require "html.php";
	
	// Extensions
	require "extensions.php";
	
	$selectedDate      = array("y" => 0, "m" => 0, "d" => 0);
	$highlightedMonths = array();
	$filterMode        = "search";
	$home              = false;
	$jQueryVersion     = "1.5.1";
	
	// Getting database time offset
	$dbtQ = $db->query("SELECT TIME_FORMAT(NOW() - UTC_TIMESTAMP(), '%H%i') AS `diff`");
	$dbtR = $db->fetch($dbtQ);
	
	$dbOffset          = date("Z") - ($dbtR['diff'] * 36); if(!is_numeric($dbOffset)){ $dbOffset = 0; }
	$dbOffset          = $dbOffset >= 0 ? "+" . $dbOffset : $dbOffset; // Explicit positivity/negativity
	
	global $db, $twitterApi, $search, $selectedDate, $highlightedMonths, $filterMode, $home, $dbOffset;
	define("DB_OFFSET", $dbOffset);
	
	// String manipulation functions
	function s($str, $flags = ENT_COMPAT){ return htmlspecialchars($str, $flags); } // Shorthand
	function x($str, $attr = NULL){ return p(s($str, ENT_NOQUOTES), $attr); } // Shorthand
	function p($str, $attr = NULL, $force = false){ global $config; return ($config['smartypants'] || $force) ? SmartyPants($str, $attr) : $str; }
	
	// Numeric manipulation functions
	function pad($int){ if($int < 10){ return "0" . $int; } return $int; }
	
	// Consts
	define("PST_GZIP", (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip") > 0));
	define("PST_GZIP_S", (PST_GZIP ? ".gz" : ""));
	
	// Check for cURL
	if(!extension_loaded("curl")){
	    $prefix = (PHP_SHLIB_SUFFIX === "dll") ? "php_" : "";
	    if(!function_exists("dl") || !@dl($prefix . "curl." . PHP_SHLIB_SUFFIX)){
	        trigger_error("Unable to load the PHP cURL extension.", E_USER_ERROR);
	        exit;
	    }
	}<commit_msg>Fix for age-old time zone issue as proposed by TheConstructor<commit_after><?php
	// TWEET NEST
	// Preheader
	
	$startTime = microtime(true);
	
	error_reporting(E_ALL ^ E_NOTICE);
	mb_language("uni");
	mb_internal_encoding("UTF-8");
	
	define("TWEET_NEST", "0.8.3"); // Version number
	
	require "config.php";
	if(empty($config['twitter_screenname'])){ header("Location: ./setup.php"); exit; }
	date_default_timezone_set($config['timezone']);
	define("DTP", $config['db']['table_prefix']);
	
	// Get the full path
	$fPath = explode(DIRECTORY_SEPARATOR, rtrim(__FILE__, DIRECTORY_SEPARATOR));
	array_pop($fPath); array_pop($fPath); // Remove inc/preheader.php
	$fPath = implode($fPath, "/");
	define("FULL_PATH", $fPath);
	
	// SmartyPants
	include "smartypants.php";
	
	// DB
	require "class.db.php";
	$db = new DB("mysql", $config['db']);
	if(!$delayedDB){ unset($config['db']['password']); }
	
	// Twitter API class
	require "class.twitterapi.php";
	$twitterApi = new TwitterApi();
	
	// Search
	require "class.search.php";
	$search = new TweetNestSearch();
	
	// Outputting various generic parts
	require "html.php";
	
	// Extensions
	require "extensions.php";
	
	$selectedDate      = array("y" => 0, "m" => 0, "d" => 0);
	$highlightedMonths = array();
	$filterMode        = "search";
	$home              = false;
	$jQueryVersion     = "1.5.1";
	
	// Getting database time offset
	$dbtQ = $db->query("SELECT TIMESTAMPDIFF(SECOND, UTC_TIMESTAMP(), NOW()) AS `diff`");
	$dbtR = $db->fetch($dbtQ);
	
	$dbOffset          = date("Z") - $dbtR['diff'];
	if(!is_numeric($dbOffset)){ $dbOffset = 0; }
	$dbOffset          = $dbOffset >= 0 ? "+" . $dbOffset : $dbOffset; // Explicit positivity/negativity
	
	global $db, $twitterApi, $search, $selectedDate, $highlightedMonths, $filterMode, $home, $dbOffset;
	define("DB_OFFSET", $dbOffset);
	
	// String manipulation functions
	function s($str, $flags = ENT_COMPAT){ return htmlspecialchars($str, $flags); } // Shorthand
	function x($str, $attr = NULL){ return p(s($str, ENT_NOQUOTES), $attr); } // Shorthand
	function p($str, $attr = NULL, $force = false){ global $config; return ($config['smartypants'] || $force) ? SmartyPants($str, $attr) : $str; }
	
	// Numeric manipulation functions
	function pad($int){ if($int < 10){ return "0" . $int; } return $int; }
	
	// Consts
	define("PST_GZIP", (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], "gzip") > 0));
	define("PST_GZIP_S", (PST_GZIP ? ".gz" : ""));
	
	// Check for cURL
	if(!extension_loaded("curl")){
	    $prefix = (PHP_SHLIB_SUFFIX === "dll") ? "php_" : "";
	    if(!function_exists("dl") || !@dl($prefix . "curl." . PHP_SHLIB_SUFFIX)){
	        trigger_error("Unable to load the PHP cURL extension.", E_USER_ERROR);
	        exit;
	    }
	}
{'fraction_non_alphanumeric': 0.19393939393939394, 'fraction_numerical': 0.006244260789715335, 'mean_word_length': 4.147448015122873, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '5957943', 'n_tokens_mistral': 2043, 'n_tokens_neox': 1914, 'n_words': 412}