<commit_before><html>
	<head>
		<style>

			html{
	
				font-family:arial;

			}

		</style>

	</head>
	<body>

<?PHP 

	$file = str_replace("setup","",getcwd());

	echo "Checking for write permissions to the root folder - $file <br>";

	if($file!=""){

		if(function_exists("is_writable")){

			if(is_writable($file)){

				echo "1. Root folder - Writable according to file permissions<Br>";

			}else{

				$file_handle = fopen($file .  "test.txt","w+");

				if(!$file_handle){

					echo "3. Root folder - Fail on file creation in the directory<br>";

				}else{

					echo "4. Root folder - Success on file writing after is_writable<br>";					

				}

				$file_handle = fwrite($file_handle,"tree");

				if(!$file_handle){

					echo "3. Root folder - Fail on file writing to the directory<br>";

				}else{

					echo "4. Root folder - Success on file writing after is_writable<br>";					

				}

				fclose($file_handle);

				unlink($file .  "test.txt");

			}

		}else{

			$file_handle = fopen($file .  "test.txt","w+");

			if(!$file_handle){

				echo "3. Root folder - Fail on file creation in the directory<br>";

			}else{

				echo "4. Root folder - Success on file writing after is_writable<br>";					

			}

			$file_handle = fwrite($file_handle,"tree");

			if(!$file_handle){

				echo "3. Root folder - Fail on file writing to the directory<br>";

			}else{

				echo "4. Root folder - Success on file writing after is_writable<br>";					

			}

			fclose($file_handle);

			unlink($file .  "test.txt");


		}

	}
			
	echo "<br><br>";

	$file = getcwd();

	echo "Checking for write permissions to the setup folder - $file <br>";

	if($file!=""){

		if(function_exists("is_writable")){

			if(is_writable($file)){

				echo "1. Setup folder - Writable according to file permissions<Br>";

			}else{

				$file_handle = fopen($file .  "test.txt","w+");

				if(!$file_handle){

					echo "3. Root folder - Fail on file creation in the directory<br><p style=\"color:#f00\">Please set this folder to be writable</p>";

				}else{

					echo "4. Root folder - Success on file writing after is_writable<br>";					

				}
	
				$file_handle = fwrite($file_handle,"tree");
	
				if(!$file_handle){

					echo "3. Root folder - Fail on file writing to the directory<br><p style=\"color:#f00\">Please set this folder to be writable</p>";

				}else{

					echo "4. Root folder - Success on file writing after is_writable<br>";					

				}

				fclose($file_handle);

				unlink($file .  "test.txt");


			}

		}else{

			$file_handle = fopen($file .  "test.txt","w+");

			if(!$file_handle){

				echo "3. Root folder - Fail on file creation in the directory<br><p style=\"color:#f00\">Please set this folder to be writable</p>";

			}else{

				echo "4. Root folder - Success on file writing after is_writable<br>";					

			}

			$file_handle = fwrite($file_handle,"tree");

			if(!$file_handle){

				echo "3. Root folder - Fail on file writing to the directory<br><p style=\"color:#f00\">Please set this folder to be writable</p>";

			}else{

				echo "4. Root folder - Success on file writing after is_writable<br>";					

			}

			fclose($file_handle);

			unlink($file .  "test.txt");


		}

	}

	echo "<br><br>";
	
	echo "Checking for write permissions to the database config file - $file/database.txt <br>";

	$file_handle = fopen("database.txt",'a+');

	$work = true;

	if(!$file_handle){

		$work = false;
		
		?>
			<p>The file <?PHP echo str_replace("\\","/",getcwd()); ?>/setup/database.txt was not set to be writable - this means future pages will not work. Please edit this file before continuing.
		<?PHP

	}
	
	if(!fwrite($file_handle," ")){

		$work = false;

		?>
			<p>The file <?PHP echo str_replace("\\","/",getcwd()); ?>/setup/database.txt could not be written too - this means future pages will not work. Please edit this file before continuing.
		<?PHP		

	}

	if($work){

		?>
			<p>The file <?PHP echo str_replace("\\","/",getcwd()); ?>/setup/database.txt has been successfully written to.
		<?PHP


	}


?>
<form action="file_system_iframe.php">
<input type="submit" value="Try again" />
</form><commit_msg>fix path output to the end user - do not have duplicte setup dirs<commit_after><html>
	<head>
		<style>
			html{
				font-family:arial;
			}
		</style>
	</head>
	<body>

<?php

	$file = str_replace("setup","",getcwd());

	echo "Checking for write permissions to the root folder - $file <br>";

	if($file!=""){

		if(function_exists("is_writable")){

			if(is_writable($file)){

				echo "1. Root folder - Writable according to file permissions<Br>";

			}else{

				$file_handle = fopen($file .  "test.txt","w+");

				if(!$file_handle){

					echo "3. Root folder - Fail on file creation in the directory<br>";

				}else{

					echo "4. Root folder - Success on file writing after is_writable<br>";					

				}

				$file_handle = fwrite($file_handle,"tree");

				if(!$file_handle){

					echo "3. Root folder - Fail on file writing to the directory<br>";

				}else{

					echo "4. Root folder - Success on file writing after is_writable<br>";					

				}

				fclose($file_handle);

				unlink($file .  "test.txt");

			}

		}else{

			$file_handle = fopen($file .  "test.txt","w+");

			if(!$file_handle){

				echo "3. Root folder - Fail on file creation in the directory<br>";

			}else{

				echo "4. Root folder - Success on file writing after is_writable<br>";					

			}

			$file_handle = fwrite($file_handle,"tree");

			if(!$file_handle){

				echo "3. Root folder - Fail on file writing to the directory<br>";

			}else{

				echo "4. Root folder - Success on file writing after is_writable<br>";					

			}

			fclose($file_handle);

			unlink($file .  "test.txt");


		}

	}
			
	echo "<br><br>";

	$file = getcwd();

	echo "Checking for write permissions to the setup folder - $file <br>";

	if($file!=""){

		if(function_exists("is_writable")){

			if(is_writable($file)){

				echo "1. Setup folder - Writable according to file permissions<Br>";

			}else{

				$file_handle = fopen($file .  "test.txt","w+");

				if(!$file_handle){

					echo "3. Root folder - Fail on file creation in the directory<br><p style=\"color:#f00\">Please set this folder to be writable</p>";

				}else{

					echo "4. Root folder - Success on file writing after is_writable<br>";					

				}
	
				$file_handle = fwrite($file_handle,"tree");
	
				if(!$file_handle){

					echo "3. Root folder - Fail on file writing to the directory<br><p style=\"color:#f00\">Please set this folder to be writable</p>";

				}else{

					echo "4. Root folder - Success on file writing after is_writable<br>";					

				}

				fclose($file_handle);

				unlink($file .  "test.txt");


			}

		}else{

			$file_handle = fopen($file .  "test.txt","w+");

			if(!$file_handle){

				echo "3. Root folder - Fail on file creation in the directory<br><p style=\"color:#f00\">Please set this folder to be writable</p>";

			}else{

				echo "4. Root folder - Success on file writing after is_writable<br>";					

			}

			$file_handle = fwrite($file_handle,"tree");

			if(!$file_handle){

				echo "3. Root folder - Fail on file writing to the directory<br><p style=\"color:#f00\">Please set this folder to be writable</p>";

			}else{

				echo "4. Root folder - Success on file writing after is_writable<br>";					

			}

			fclose($file_handle);

			unlink($file .  "test.txt");


		}

	}

	echo "<br><br>";
	
	echo "Checking for write permissions to the database config file - $file/database.txt <br>";

	$file_handle = fopen("database.txt",'a+');

	$work = true;

	if(!$file_handle){

		$work = false;
		
		?>
			<p>The file <?PHP echo str_replace("\\","/",getcwd()); ?>/database.txt was not set to be writable - this means future pages will not work. Please edit this file before continuing.
		<?PHP

	}
	
	if(!fwrite($file_handle," ")){

		$work = false;

		?>
			<p>The file <?PHP echo str_replace("\\","/",getcwd()); ?>/database.txt could not be written too - this means future pages will not work. Please edit this file before continuing.
		<?PHP		

	}

	if($work){

		?>
			<p>The file <?PHP echo str_replace("\\","/",getcwd()); ?>/database.txt has been successfully written to.
		<?PHP


	}


?>
<form action="file_system_iframe.php">
<input type="submit" value="Try again" />
</form>

{'fraction_non_alphanumeric': 0.15922190201729106, 'fraction_numerical': 0.006243996157540826, 'mean_word_length': 2.9511385199240987, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 107, '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': '4772121', 'n_tokens_mistral': 3412, 'n_tokens_neox': 2728, 'n_words': 819}