<commit_before><?php 

namespace Vinala\Kernel\Access;

use Vinala\Kernel\Config\Config;
use Vinala\Kernel\Foundation\Application;

/**
* Url class
*/
class Url
{
	public static $css;
	public static $js;
	public static $img;

	public static function redirect($url)
	{
		$link="";
		if ($url[0] == "@") {
		    $link=Config::get('app.url').substr($url, 1);;
		    echo $link."<br>";
		    echo $url;
		}
		else
		{
			$link=$url;
		    echo $link;
		}
		header("location:".$link);
	}

	public static function ini()
	{
		self::$css=Application::$root."app/resources/css/";
		self::$js=Application::$root."app/resources/js/";
		self::$img=Application::$root."app/resources/images/";
	}
}<commit_msg>add function to get root url<commit_after><?php 

namespace Vinala\Kernel\Access;

use Vinala\Kernel\Config\Config;
use Vinala\Kernel\Foundation\Application;
use Vinala\Kernel\Filesystem\File;

/**
* Url class
*/
class Url
{
	public static $css;
	public static $js;
	public static $img;

	public static function redirect($url)
	{
		$link="";
		if ($url[0] == "@") {
		    $link=Config::get('app.url').substr($url, 1);;
		    echo $link."<br>";
		    echo $url;
		}
		else
		{
			$link=$url;
		    echo $link;
		}
		header("location:".$link);
	}

	public static function ini()
	{
		self::$css=Application::$root."app/resources/css/";
		self::$js=Application::$root."app/resources/js/";
		self::$img=Application::$root."app/resources/images/";
	}


	/**
	* Get the route url of the app
	*
	* @return string
	*/
	public static function root()
	{
		$url = request('REQUEST_URI' , '' , 'server');
		$root = request('DOCUMENT_ROOT' , '' , 'server');

		$url = substr($url, 1);

		$parts = explode("/", $url);
		//
		$folder = "";
		//
		for ($i=0; $i < count($parts) ; $i++) 
		{
			if( File::isDirectory($root.$folder.$parts[$i]."/")) 
			{
				$folder .= $parts[$i]."/";
			}
			else
			{
				return $folder;
			}
		}
	}
	
}
{'fraction_non_alphanumeric': 0.2082463465553236, 'fraction_numerical': 0.003131524008350731, 'mean_word_length': 3.269487750556793, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 5, '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': '6136179', 'n_tokens_mistral': 795, 'n_tokens_neox': 719, 'n_words': 135}