<commit_before><?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Pages_m extends MY_Model
{
    public function get_by_path($segments = array())
    {
    	// If the URI has been passed as a string, explode to create an array of segments
    	if(is_string($segments))
        {
        	$segments = explode('/', $segments);
        }
    	
    	// Work out how many segments there are
        $total_segments = count($segments);
        
		// Which is the target alias (the final page in the tree)
        $target_alias = 'p'.$total_segments;

        // Start Query, Select (*) from Target Alias, from Pages
        $this->db->select($target_alias.'.*');
        $this->db->from('pages p1');
        
        // Loop thorugh each Slug
        $level = 1;
        foreach( $segments as $segment )
        {
            // Current is the current page, child is the next page to join on.
            $current_alias = 'p'.$level;
            $child_alias = 'p'.($level - 1);
    
            // We dont want to join the first page again
            if($level != 1)
            {
                $this->db->join('pages '.$current_alias, $current_alias.'.parent_id = '.$child_alias.'.id');
            }
            
            // Add slug to where clause to keep us on the right tree
            $this->db->where($current_alias . '.slug', $segment);
    
            // Increment
            ++$level;
        }
        
        // Can only be one result
        $this->db->limit(1);
        
        return $this->db->get()->row();
    }
    
	// Count the amount of pages with param X
	function count($params = array())
	{
		$results = $this->get_many($params);
		
		return count($results);
	}
    
	function has_children($parent_id)
	{
		$this->db->where('parent_id', $parent_id);
		return $this->db->count_all_results('pages') > 0;
	}
	
	function get_descendant_ids($id, $id_array = array())
	{
		$id_array[] = $id;
	
		$children = $this->db->select('id, title')
			->where('parent_id', $id)
			->get('pages')->result();
		
		$has_children = !empty($children);
		<commit_msg>Fixed incorrect method refference in pages_m.php<commit_after><?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Pages_m extends MY_Model
{
    public function get_by_path($segments = array())
    {
    	// If the URI has been passed as a string, explode to create an array of segments
    	if(is_string($segments))
        {
        	$segments = explode('/', $segments);
        }
    	
    	// Work out how many segments there are
        $total_segments = count($segments);
        
		// Which is the target alias (the final page in the tree)
        $target_alias = 'p'.$total_segments;

        // Start Query, Select (*) from Target Alias, from Pages
        $this->db->select($target_alias.'.*');
        $this->db->from('pages p1');
        
        // Loop thorugh each Slug
        $level = 1;
        foreach( $segments as $segment )
        {
            // Current is the current page, child is the next page to join on.
            $current_alias = 'p'.$level;
            $child_alias = 'p'.($level - 1);
    
            // We dont want to join the first page again
            if($level != 1)
            {
                $this->db->join('pages '.$current_alias, $current_alias.'.parent_id = '.$child_alias.'.id');
            }
            
            // Add slug to where clause to keep us on the right tree
            $this->db->where($current_alias . '.slug', $segment);
    
            // Increment
            ++$level;
        }
        
        // Can only be one result
        $this->db->limit(1);
        
        return $this->db->get()->row();
    }
    
	// Count the amount of pages with param X
	function count($params = array())
	{
		$results = $this->get_many_by($params);
		
		return count($results);
	}
    
	function has_children($parent_id)
	{
		$this->db->where('parent_id', $parent_id);
		return $this->db->count_all_results('pages') > 0;
	}
	
	function get_descendant_ids($id, $id_array = array())
	{
		$id_array[] = $id;
	
		$children = $this->db->select('id, title')
			->where('parent_id', $id)
			->get('pages')->result();
		
		$has_children = !empty($children);
		
{'fraction_non_alphanumeric': 0.14658823529411766, 'fraction_numerical': 0.002823529411764706, 'mean_word_length': 2.008492569002123, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, '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': '1209457', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1281, 'n_words': 351}