<commit_before><?php
/**
 * @version		$Id: weblinks.php 1291 2011-05-16 22:13:45Z johanjanssens $
 * @package     Nooku_Server
 * @subpackage  Pages
 * @copyright	Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

/**
 * Pages Module Html Class
 *
 * @author    	<NAME> <http://nooku.assembla.com/profile/gergoerdosi>
 * @package     Nooku_Server
 * @subpackage  Pages
 */
class ComPagesModuleMenuHtml extends ComDefaultModuleDefaultHtml
{
    public function display()
    {
        $start    = $this->module->params->get('start_level') + 1;
        $end      = $this->module->params->get('end_evel') + 1;
        $children = $this->module->params->get('show_children', 'active');
        $pages    = $this->getService('application.pages');

        $this->active = $pages->getActive();
        $this->pages  = $pages->find(array('pages_menu_id' => $this->module->params->get('menu_id'), 'hidden' => 0));

        foreach($pages as $page)
        {
            $extract = false;
            
            // Extract if level is lower than start or higher than end.
            if($page->level < $start || ($end > $start && $page->level > $end)) {
                $extract = true;
            }
            
            // Extract if show_children = active and page is not child of active.
            if(!$extract && $page->level > $start && $children == 'active')
            {
                if($page->level > $this->active->level + 1) {
                    $extract = true;
                }
                
                if(!$extract && strpos($page->path, $this->active->path) !== 0) {
                    $extract = true;
                }
            } 
            
            if($extract) {
                $this->pages->extract($page);
            }
        }
        
        $this->assign('show_title', $this->module->params->get('show_title', false));
        $this->assign('class', $this->module->params->get('class', 'nav'));
        
        return parent::display();
    }
}<commit_msg>Fixed bug, siblings of the active child were extracted re #168<commit_after><?php
/**
 * @version		$Id: weblinks.php 1291 2011-05-16 22:13:45Z johanjanssens $
 * @package     Nooku_Server
 * @subpackage  Pages
 * @copyright	Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

/**
 * Pages Module Html Class
 *
 * @author    	<NAME> <http://nooku.assembla.com/profile/gergoerdosi>
 * @package     Nooku_Server
 * @subpackage  Pages
 */
class ComPagesModuleMenuHtml extends ComDefaultModuleDefaultHtml
{
    public function display()
    {
        $start    = $this->module->params->get('start_level') + 1;
        $end      = $this->module->params->get('end_evel') + 1;
        $children = $this->module->params->get('show_children', 'active');
        $pages    = $this->getService('application.pages');

        $this->active = $pages->getActive();
        $this->pages  = $pages->find(array('pages_menu_id' => $this->module->params->get('menu_id'), 'hidden' => 0));

        foreach($pages as $page)
        {
            $extract = false;
            
            // Extract if level is lower than start or higher than end.
            if($page->level < $start || ($end > $start && $page->level > $end)) {
                $extract = true;
            }
            
            // Extract if show_children = active and page is not child of active.
            if(!$extract && $page->level > $start && $children == 'active')
            {
                if($page->level > $this->active->level + 1) {
                    $extract = true;
                }
                
                if(!$extract) {
	    			// Create a merged array from $page->path and $this->active->path
	                $paths = array_merge(explode("/", $page->path), explode("/", $this->active->path));
		            
		            // Extract if array has no duplicated values
		            if (count($paths) === count(array_unique($paths))) {
	                    $extract = true;
	                }
	            }
            } 
            
            if($extract) {
                $this->pages->extract($page);
            }
        }
        
        $this->assign('show_title', $this->module->params->get('show_title', false));
        $this->assign('class', $this->module->params->get('class', 'nav'));
        
        return parent::display();
    }
}
{'fraction_non_alphanumeric': 0.16188613646240765, 'fraction_numerical': 0.014341590612777053, 'mean_word_length': 1.8501547987616098, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 96, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '930572', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1336, 'n_words': 280}