<commit_before><?
require_once('abstractModule.php');
class ServiceModule extends abstractModule{
  //Service module
  
  public function match($uri){
  	global $conf; 
  	global $acceptContentType; 
    global $localUri;
    global $lodspk;
  	$q = preg_replace('|^'.$conf['basedir'].'|', '', $localUri);
 	$qArr = explode('/', $q);
  	if(sizeof($qArr)==0){
  	  return FALSE;
  	}
  	$extension = Utils::getExtension($acceptContentType); 
  	$lodspk['model'] = $conf['home'].$conf['model']['directory'].$conf['service']['prefix'].$qArr[0].'/';
  	$lodspk['view'] = $conf['home'].$conf['view']['directory'].$conf['service']['prefix'].$qArr[0].'/';
  	$viewFile  = $extension.".template";
  	$modelFile = $extension.".queries";
  	if(file_exists($lodspk['model']) && file_exists($lodspk['view'])){
  	  if(!file_exists($lodspk['view'].$viewFile)){
  	  	$viewFile = null;  	  
  	  }
  	  if(file_exists($lodspk['model'].$modelFile) && $qArr[0] != null){
  	  	trigger_error("Using model ".$modelFile." and view ".$viewFile, E_USER_NOTICE);
  	  	return array($modelFile, $viewFile);
  	  }elseif($extension != 'html' && file_exists($lodspk['model'].'/html.queries')){
  	  	$modelFile = 'html.queries';
  	  	trigger_error("Using ".$modelFile." as model. It will be used as a CONSTRUCT", E_USER_NOTICE);
  	  	return array($modelFile, $viewFile);
  	  }else{
  	  	Utils::send406($uri);
  	  	exit(0);
  	  }
  	}
  	
  	return FALSE;  
  }
  
  public function execute($service){
  	global $conf;
  	global $localUri;
  	global $uri;
  	global $acceptContentType;
  	global $endpoints;
  	global $lodspk;
  	global $first;
  	$context = array();
  	$context['contentType'] = $acceptContentType;
  	$context['endpoints'] = $endpoints;
  	//$sp = new SpecialFunction();
  	//$sp->execute($localUri, $context);
  	$f = $this->getFunction($localUri);
  	$params = array();
  	$params = $this->getParams($localUri);
  	//$params[] = $context;
  	$acceptContentType = Utils::getBestContentType($_SERVER['HTTP_ACCEPT']);
  	$extension = Utils::getExtension($acceptContentType); 
  	$args = array();
  	list($modelFile, $viewFile) = $service;
  	
  	try{
  	  $prefixHeader = array();
  	  
  	  for($i=0;$i<sizeof($params);$i++){
  	  	if($conf['mirror_external_uris']){
  	  	  $altUri = Utils::curie2uri($params[$i]);
  	  	  $altUri = preg_replace("|^".$conf['basedir']."|", $conf['ns']['local'], $altUri);
  	  	  $params[$i] = Utils::uri2curie($altUri);
  	  	}
  	  }
  	  
  	  $segmentConnector = "";
  	  for($i=0;$i<sizeof($params);$i++){  
  	  	$auxPrefix = Utils::getPrefix($params[$i]);
  	  	if($auxPrefix['ns'] != NULL){
  	  	  $prefixHeader[] = $auxPrefix;
  	  	}
  	  	$args["arg".$i]=$params[$i];
  	  	$args["all"] .= $segmentConnector.$params[$i];
  	  	if($segmentConnector == ""){
  	  	  $segmentConnector = "/";
  	  	}
  	  }
  	  var_dump($_SERVER['QUERY_STRING']);exit(0);
  	  $results['params'] = $params;
  	  
  	  <commit_msg>Fixing debug termination left<commit_after><?
require_once('abstractModule.php');
class ServiceModule extends abstractModule{
  //Service module
  
  public function match($uri){
  	global $conf; 
  	global $acceptContentType; 
    global $localUri;
    global $lodspk;
  	$q = preg_replace('|^'.$conf['basedir'].'|', '', $localUri);
 	$qArr = explode('/', $q);
  	if(sizeof($qArr)==0){
  	  return FALSE;
  	}
  	$extension = Utils::getExtension($acceptContentType); 
  	$lodspk['model'] = $conf['home'].$conf['model']['directory'].$conf['service']['prefix'].$qArr[0].'/';
  	$lodspk['view'] = $conf['home'].$conf['view']['directory'].$conf['service']['prefix'].$qArr[0].'/';
  	$viewFile  = $extension.".template";
  	$modelFile = $extension.".queries";
  	if(file_exists($lodspk['model']) && file_exists($lodspk['view'])){
  	  if(!file_exists($lodspk['view'].$viewFile)){
  	  	$viewFile = null;  	  
  	  }
  	  if(file_exists($lodspk['model'].$modelFile) && $qArr[0] != null){
  	  	trigger_error("Using model ".$modelFile." and view ".$viewFile, E_USER_NOTICE);
  	  	return array($modelFile, $viewFile);
  	  }elseif($extension != 'html' && file_exists($lodspk['model'].'/html.queries')){
  	  	$modelFile = 'html.queries';
  	  	trigger_error("Using ".$modelFile." as model. It will be used as a CONSTRUCT", E_USER_NOTICE);
  	  	return array($modelFile, $viewFile);
  	  }else{
  	  	Utils::send406($uri);
  	  	exit(0);
  	  }
  	}
  	
  	return FALSE;  
  }
  
  public function execute($service){
  	global $conf;
  	global $localUri;
  	global $uri;
  	global $acceptContentType;
  	global $endpoints;
  	global $lodspk;
  	global $first;
  	$context = array();
  	$context['contentType'] = $acceptContentType;
  	$context['endpoints'] = $endpoints;
  	//$sp = new SpecialFunction();
  	//$sp->execute($localUri, $context);
  	$f = $this->getFunction($localUri);
  	$params = array();
  	$params = $this->getParams($localUri);
  	//$params[] = $context;
  	$acceptContentType = Utils::getBestContentType($_SERVER['HTTP_ACCEPT']);
  	$extension = Utils::getExtension($acceptContentType); 
  	$args = array();
  	list($modelFile, $viewFile) = $service;
  	
  	try{
  	  $prefixHeader = array();
  	  
  	  for($i=0;$i<sizeof($params);$i++){
  	  	if($conf['mirror_external_uris']){
  	  	  $altUri = Utils::curie2uri($params[$i]);
  	  	  $altUri = preg_replace("|^".$conf['basedir']."|", $conf['ns']['local'], $altUri);
  	  	  $params[$i] = Utils::uri2curie($altUri);
  	  	}
  	  }
  	  
  	  $segmentConnector = "";
  	  for($i=0;$i<sizeof($params);$i++){  
  	  	$auxPrefix = Utils::getPrefix($params[$i]);
  	  	if($auxPrefix['ns'] != NULL){
  	  	  $prefixHeader[] = $auxPrefix;
  	  	}
  	  	$args["arg".$i]=$params[$i];
  	  	$args["all"] .= $segmentConnector.$params[$i];
  	  	if($segmentConnector == ""){
  	  	  $segmentConnector = "/";
  	  	}
  	  }
  	  $results['params'] = $params;
  	  
  	  
{'fraction_non_alphanumeric': 0.21075012757271644, 'fraction_numerical': 0.004252423881612519, 'mean_word_length': 3.5865834633385334, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '798590', 'n_tokens_mistral': 2287, 'n_tokens_neox': 2263, 'n_words': 312}