<commit_before><?php
	loadConfig();
	
	function loadConfig() {
		global $board, $config;
		
		require 'config.php';
		if (file_exists('inc/instance-config.php')) {
			require 'instance-config.php';
		}
		
		$config['post_url']		= $config['root'] . $config['file_post'];
		
		$config['url_match'] = '/^' .
			(preg_match($config['url_regex'], $config['root']) ? '' :
				(@$_SERVER['HTTPS']?'https':'http') .
				':\/\/'.$_SERVER['HTTP_HOST']) .
				preg_quote($config['root'], '/') .
			'(' .
					str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) .
				'|' .
					str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) .
					preg_quote($config['file_index'], '/') .
				'|' .
					str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) .
					str_replace('%d', '\d+', preg_quote($config['file_page'], '/')) .
				'|' .
					preg_quote($config['file_mod'], '/') .
				'\?\/.+' .
			')$/i';
		
		$config['dir']['static']	= $config['root'] . 'static/';
		
		$config['image_sticky']		= $config['dir']['static'] . 'sticky.gif';
		$config['image_locked']		= $config['dir']['static'] . 'locked.gif';
		$config['image_deleted']	= $config['dir']['static'] . 'deleted.png';
		$config['image_zip']		= $config['dir']['static'] . 'zip.png';
	}
	
	function sprintf3($str, $vars, $delim = '%') {
		$replaces = array();
		foreach($vars as $k => $v) {
			$replaces[$delim . $k . $delim] = $v;
		}
		return str_replace(array_keys($replaces),
		                   array_values($replaces), $str);
	}
	
	function setupBoard($array) {
		global $board, $config;
		
		$board = Array(
		'id' => $array['id'],
		'uri' => $array['uri'],
		'name' => $array['title'],
		'title' => $array['subtitle']);
		<commit_msg>Don't overwrite configs when loading<commit_after><?php
	loadConfig();
	
	function loadConfig() {
		global $board, $config;
		
		require 'config.php';
		if (file_exists('inc/instance-config.php')) {
			require 'instance-config.php';
		}
		
		if(!isset($config['post_url']))
			$config['post_url']		= $config['root'] . $config['file_post'];
		
		if(!isset($config['url_match']))
			$config['url_match'] = '/^' .
				(preg_match($config['url_regex'], $config['root']) ? '' :
					(@$_SERVER['HTTPS']?'https':'http') .
					':\/\/'.$_SERVER['HTTP_HOST']) .
					preg_quote($config['root'], '/') .
				'(' .
						str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) .
					'|' .
						str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) .
						preg_quote($config['file_index'], '/') .
					'|' .
						str_replace('%s', '\w{1,8}', preg_quote($config['board_path'], '/')) .
						str_replace('%d', '\d+', preg_quote($config['file_page'], '/')) .
					'|' .
						preg_quote($config['file_mod'], '/') .
					'\?\/.+' .
				')$/i';
		
		if(!isset($config['dir']['static']))
			$config['dir']['static']	= $config['root'] . 'static/';
		
		if(!isset($config['image_sticky']))
			$config['image_sticky']		= $config['dir']['static'] . 'sticky.gif';
		if(!isset($config['image_locked']))
			$config['image_locked']		= $config['dir']['static'] . 'locked.gif';
		if(!isset($config['image_deleted']))
			$config['image_deleted']	= $config['dir']['static'] . 'deleted.png';
		if(!isset($config['image_zip']))
			$config['image_zip']		= $config['dir']['static'] . 'zip.png';
	}
	
	function sprintf3($str, $vars, $delim = '%') {
		$replaces = array();
		foreach($vars as $k => $v) {
			$replaces[$delim . $k . $delim] = $v;
		}
		return str_replace(array_keys($replaces),
		                   array_values($replaces), $str);
	}
	
	function setupBoard($array) {
		global $board, $config;
		
		$board = Array(
		'id' => $array['id'],
		'uri' => $array['uri'],
		'name' => $array['title'],
		'title' => $array['subtitle']);
		
{'fraction_non_alphanumeric': 0.2740995762711864, 'fraction_numerical': 0.003707627118644068, 'mean_word_length': 3.6919254658385094, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5585359', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1387, 'n_words': 181}