<commit_before><?php

// $Id$

require_once '../../config/config.conf';
require_once $sysRoot.'config/db_connect.inc';
require_once $sysRoot.'alpha/controller/Controller.inc';
require_once $sysRoot.'alpha/util/log_file.inc';


// load the business object (BO) definition
if (isset($_GET["log_path"])) {
	$log_path = $_GET["log_path"];	
}else{
	$error = new handle_error($_SERVER["PHP_SELF"],'No log file path available to view!','GET');
	exit;
}

/**
* 
* Controller used to display a log file, the path for which must be supplied in GET vars
* 
* @package Alpha Core Scaffolding
* @author <NAME> <<EMAIL>>
* @copyright 2007 <NAME>
*
*/
class view_log extends Controller
{	
	/**
	 * the path to the log that we are displaying
	 * @var string
	 */
	var $log_path;
	
	/**
	 * constructor that renders the page
	 * @param string $log_path the path to the log that we are displaying
	 */
	function view_log($log_path) {
				
		// ensure that the super class constructor is called
		$this->Controller();
		
		$this->log_path = $log_path;
				
		$this->set_visibility('Administrator');
		if(!$this->check_rights()) {
			exit;
		}
		
		$this->set_title("Displaying the latest Error Log");
		
		$this->display_page_head();
		
		$log = new log_file($this->log_path);
		if(preg_match("/error_log.*/", basename($this->log_path)))
			$log->render_log(array("Date of error","Error file","Error method","Error message","Error type","Client IP","Client Server","Client Application"));
		if(preg_match("/search_log.*/", basename($this->log_path)))
			$log->render_log(array("Search query","Search date","Client Application","Client IP"));		
		
		$this->display_page_foot();
	}
	
	/**
	 * method to display the page head with pageination links<commit_msg>Added in support for the feed log<commit_after><?php

// $Id$

require_once '../../config/config.conf';
require_once $sysRoot.'config/db_connect.inc';
require_once $sysRoot.'alpha/controller/Controller.inc';
require_once $sysRoot.'alpha/util/log_file.inc';


// load the business object (BO) definition
if (isset($_GET["log_path"])) {
	$log_path = $_GET["log_path"];	
}else{
	$error = new handle_error($_SERVER["PHP_SELF"],'No log file path available to view!','GET');
	exit;
}

/**
* 
* Controller used to display a log file, the path for which must be supplied in GET vars
* 
* @package Alpha Core Scaffolding
* @author <NAME> <<EMAIL>>
* @copyright 2007 <NAME>
*
*/
class view_log extends Controller
{	
	/**
	 * the path to the log that we are displaying
	 * @var string
	 */
	var $log_path;
	
	/**
	 * constructor that renders the page
	 * @param string $log_path the path to the log that we are displaying
	 */
	function view_log($log_path) {
				
		// ensure that the super class constructor is called
		$this->Controller();
		
		$this->log_path = $log_path;
				
		$this->set_visibility('Administrator');
		if(!$this->check_rights()) {
			exit;
		}
		
		$this->set_title("Displaying the requested log");
		
		$this->display_page_head();
		
		$log = new log_file($this->log_path);
		if(preg_match("/error_log.*/", basename($this->log_path)))
			$log->render_log(array("Date of error","Error file","Error method","Error message","Error type","Client IP","Client Server","Client Application"));
		if(preg_match("/search_log.*/", basename($this->log_path)))
			$log->render_log(array("Search query","Search date","Client Application","Client IP"));
		if(preg_match("/feed_log.*/", basename($this->log_path)))
			$log->render_log(array("Business object","Feed type","Request date","Client Application","Client IP"));		
		
		$this->display_page_foot();
	}
	
	/**
	 * method to display the page head with pageination links
{'fraction_non_alphanumeric': 0.1644808743169399, 'fraction_numerical': 0.002185792349726776, 'mean_word_length': 4.447916666666667, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 37, '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': '3478805', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1143, 'n_words': 304}