<commit_before><?php
/**
 * Routing for requests
 * 
 * All the posible routes get mapped here and matched in the front controller
 */
try {
  $fc = new \Foundation\VC\FrontController();
  
  $basicRouter = new Lvc_RegexRewriteRouter;
  
  //anything with a trailing slash gets redirected without it
  //this should be done with modrewrite so we get a permanent redirect, but it is here in case
  //modrewrite isn't available
  $basicRouter->addRoute('#(.*)/$#', array( 
    'redirect' => 'index.php?url=$1'
  ));
  
  
  //resources in the virtual file system
  $basicRouter->addRoute('#^(?:.*)/?resource/(.*)$#i', array( 
    'controller' => 'resource',
    'action' => 'get',
    'action_params' => array(
      'path' => 1
    )
  ));
  
  //dynmaic files like applicant pdfs and previews stored in sessions
  $basicRouter->addRoute('#^(?:.*)/?file/(.*)$#i', array( 
    'controller' => 'file',
    'action' => 'get',
    'action_params' => array(
      'name' => 1
    )
  ));
  
  //the apply page is the actual application
  $basicRouter->addRoute('#^apply/([^/]+)/([^/]+)/page/([0-9]+)/?(?:(index|edit|delete)/([0-9]+)(/[0-9]+)?)?$#i', array(
    'controller' => 'apply_page',
    'action' => 4,
    'action_params' => array(
      'programShortName' => 1,
      'cycleName' => 2,
      'pageID' => 3,
      'answerID' => 5
    )
  ));
  
  //special do type sends a second string to identify the method and an optional answerid
  $basicRouter->addRoute('#^apply/([^/]+)/([^/]+)/page/([0-9]+)/do/([^/]+)/?([0-9]+)?$#i', array(
    'controller' => 'apply_page',
    'action' => 'do',
    'action_params' => array(
      'programShortName' => 1,
      'cycleName' => 2,
      'pageID' => 3,
      'what' => 4,
      'answerID' => 5
    )
  ));
  
  //apply welcome handles requests until we know which application we are seeing
  $basicRouter->addRoute('#^apply/?([^/]*)/?([^/]*)$#i', array(
    'controller' => 'apply_welcome',
    'action' => 'index',
    'action_params' => array(
      'programShortName' => 1,
      'cycleName' => 2
    )
  ));
  
  //lor requests
  $basicRouter->addRoute('#^lor/([^/]+)$#i', array(
    'controller' => 'lor',
    'action' => 'index',
    'action_params' => array(
      'urlKey' => 1
    )
  ));
  
  //single applicant view
  $basicRouter->addRoute('#^applicants/single/([0-9]+)/?([^/]+)?/?(.*)$#i', array(
    'controller' => 'applicants_single',
    'action' => 2,
    'action_params' => array(
      'applicantId' => 1
    ),
    'additional_params' => 3<commit_msg>route applicant/single requests corrrectly now that everythign is prefixedd with admin<commit_after><?php
/**
 * Routing for requests
 * 
 * All the posible routes get mapped here and matched in the front controller
 */
try {
  $fc = new \Foundation\VC\FrontController();
  
  $basicRouter = new Lvc_RegexRewriteRouter;
  
  //anything with a trailing slash gets redirected without it
  //this should be done with modrewrite so we get a permanent redirect, but it is here in case
  //modrewrite isn't available
  $basicRouter->addRoute('#(.*)/$#', array( 
    'redirect' => 'index.php?url=$1'
  ));
  
  
  //resources in the virtual file system
  $basicRouter->addRoute('#^(?:.*)/?resource/(.*)$#i', array( 
    'controller' => 'resource',
    'action' => 'get',
    'action_params' => array(
      'path' => 1
    )
  ));
  
  //dynmaic files like applicant pdfs and previews stored in sessions
  $basicRouter->addRoute('#^(?:.*)/?file/(.*)$#i', array( 
    'controller' => 'file',
    'action' => 'get',
    'action_params' => array(
      'name' => 1
    )
  ));
  
  //the apply page is the actual application
  $basicRouter->addRoute('#^apply/([^/]+)/([^/]+)/page/([0-9]+)/?(?:(index|edit|delete)/([0-9]+)(/[0-9]+)?)?$#i', array(
    'controller' => 'apply_page',
    'action' => 4,
    'action_params' => array(
      'programShortName' => 1,
      'cycleName' => 2,
      'pageID' => 3,
      'answerID' => 5
    )
  ));
  
  //special do type sends a second string to identify the method and an optional answerid
  $basicRouter->addRoute('#^apply/([^/]+)/([^/]+)/page/([0-9]+)/do/([^/]+)/?([0-9]+)?$#i', array(
    'controller' => 'apply_page',
    'action' => 'do',
    'action_params' => array(
      'programShortName' => 1,
      'cycleName' => 2,
      'pageID' => 3,
      'what' => 4,
      'answerID' => 5
    )
  ));
  
  //apply welcome handles requests until we know which application we are seeing
  $basicRouter->addRoute('#^apply/?([^/]*)/?([^/]*)$#i', array(
    'controller' => 'apply_welcome',
    'action' => 'index',
    'action_params' => array(
      'programShortName' => 1,
      'cycleName' => 2
    )
  ));
  
  //lor requests
  $basicRouter->addRoute('#^lor/([^/]+)$#i', array(
    'controller' => 'lor',
    'action' => 'index',
    'action_params' => array(
      'urlKey' => 1
    )
  ));
  
  //single applicant view
  $basicRouter->addRoute('#^admin/applicants/single/([0-9]+)/?([^/]+)?/?(.*)$#i', array(
    'controller' => 'applicants_single',
    'action' => 2,
    'action_params' => array(
      'applicantId' => 1
    ),
    'additional_params' => 3
{'fraction_non_alphanumeric': 0.21756994717276462, 'fraction_numerical': 0.012130698493445509, 'mean_word_length': 2.935334872979215, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 95, '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': '1301887', 'n_tokens_mistral': 1841, 'n_tokens_neox': 1753, 'n_words': 411}