<commit_before><?php
namespace App\Controller;

use App\Controller\AppController;

/**
 * ExternalReferences Controller
 *
 * @property \App\Model\Table\ExternalReferencesTable $ExternalReferences
 */
 
class StatisticsController extends AppController
{
  
    
      public function index()
    {
       // $this->Statistic->$useTable = '';
       //$this->loadModel('');
       $this->loadModel('People');
    
        $statistic = $this->Statistics->newEntity();
        if ($this->request->is('post')) {
            
           //acá va el código para las consultas
           
            $s = $this->request->data;
            $data = array($s);
            
           $nacionalidad = $data[0]['nacionalidad'];
           $edad = $data[0]['edad'];
           $escolaridad = $data[0]['escolaridad'];
           $estado_civil = $data[0]['estado_civil'];
           $ocupacion = $data[0]['ocupacion'];
           //print_r($data[0]);
           echo $edad;
           
            if ($data[0] != NULL) {
                
                //se declaran los criterios de búsqueda
               $opciones=array('conditions'=> array('People.edad >=' => $edad,'People.nacionalidad >=' => $nacionalidad ));
               
               //se construye el query
	           $query = $this->People->find('all',$opciones);
	           
	           //se recorre el resultado de la consulta
                foreach ($query as $row) {
                    echo $row->nombre.' -> '.$row->nacionalidad;
                
                }
                
                //,array('conditions'=>array(array('People.edad BETWEEN ? AND ?' => array(15,45))))
                //int_r($personasFiltradas);
                
                $this->Flash->success(__('The person has been saved.'));
                //echo $statistic;
                //return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error(__('Please, try again.'));
            }<commit_msg>Se agrega consulta para las estadísticas de las víctimas<commit_after><?php
namespace App\Controller;

use App\Controller\AppController;

/**
 * ExternalReferences Controller
 *
 * @property \App\Model\Table\ExternalReferencesTable $ExternalReferences
 */
 
class StatisticsController extends AppController
{
  
    
      public function index()
    {
       // $this->Statistic->$useTable = '';
       //$this->loadModel('');
       $this->loadModel('People');
    
        $statistic = $this->Statistics->newEntity();
        if ($this->request->is('post')) {
            
           //acá va el código para las consultas
           
            $s = $this->request->data;
            $data = array($s);
            
           $nacionalidad = $data[0]['nacionalidad'];
           $edad = $data[0]['edad'];
           $escolaridad = $data[0]['escolaridad'];
           $estado_civil = $data[0]['estado_civil'];
           $ocupacion = $data[0]['ocupacion'];
           //print_r(array_filter($data[0]));
           //echo $edad;
           
            if ($data[0] != NULL) {
                
                //se declaran los criterios de búsqueda
                
                $arreglo = array('People.edad >=' => '1','People.nacionalidad' => '' );
                
                //elimina los campos en blanco del query
                $array = array_filter($arreglo);
                
               $opciones=array('conditions'=> (array('People.edad >=' => '0','People.nacionalidad' => '' )));
               
               print_r(($array));
           
               //se construye el query
	          $query = $this->People->find('all',$opciones);
	           
	           //se recorre el resultado de la consulta
                foreach ($query as $row) {
                    //echo $row->nombre.' -> '.$row->nacionalidad;
                
                }
                
                //,array('conditions'=>array(array('People.edad BETWEEN ? AND ?' => array(15,45))))
                //int_r($personasFiltradas);
                
                $this->Flash->success(__('The person has been saved.'));
                //echo $statistic;
                //return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error(__('Please, try again.'));
            }
{'fraction_non_alphanumeric': 0.1538105165624276, 'fraction_numerical': 0.005559416261292564, 'mean_word_length': 1.5236703682057275, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, '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': '6705772', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1168, 'n_words': 220}