<? if (is_array($this->pages)): ?>
  <?
  $settings = \front\factory\Settings::settings_details();
  ?>
  <ol>
      <? foreach ($this->pages as $page): ?>
        <li id="list_<?= $page['id']; ?>" idk="<?= $page['id']; ?>" class="list_<?= $page['id']; ?>" menu="<?= $page['menu_id']; ?>">
            <div class="content">
                <span class="disclose"><span></span></span>
                        <?
                        if (!$page['status'])
                          echo '<i class="fa fa-ban fa-lg text-danger" title="Strona nieaktywna"></i>';

                        if ($page['start'])
                          echo '<i class="fa fa-star fa-lg text-system" title="Strona startowa"></i>';

                        echo mb_substr( $page['title'], 0, 50, 'UTF-8' );
                        if ( strlen( $page['title'] ) > 50 )
                          echo '...';

                        if (is_array($page['languages'])):
                          echo '<div class="btn-group flags" style="display: inline-block;">';
                          foreach ($page['languages'] as $lg)
                            echo '<img src="/admin/css/lang-' . $lg['lang_id'] . '.jpg" />';
                          echo '</div>';
                        endif;

                        $default_language = \front\factory\Languages::default_language();
                        if (is_array($page['languages'])):
                          foreach ($page['languages'] as $lg):
                            echo '<div class="btn-group ml20 pull-right">';
                            echo '<a href="#" title="Wybierz stronę" class="btn btn-sm btn-system button url-select" url="';

                            if ($settings['links_structure']) {
                              if ($lg['seo_link']) {
                               $seo = '/'.\admin\factory\Pages::google_url_preview($page['id'], $lg['title'], $lg['lang_id'], 0, 0, $lg['seo_link']);
                             echo $seo;
                               }
                              else{
                                 $seo = '/'. \admin\factory\Pages::google_url_preview($page['id'], $lg['title'], $lg['lang_id'], 0, 0, 0);
                             echo $seo;
                              }
                            }
                            else
                            {
                              if ($lg['seo_link']) {
                                if ($default_language != $lg['lang_id'])
                                  echo '/' . $lg['lang_id'];
                                echo '/' . $lg['seo_link'];
                              }
                              else {
                                if ($default_language != $lg['lang_id'])
                                  echo '/' . $lg['lang_id'];
                                echo '/s-' . $page['id'] . '-' . \S::seo($lg['title']);
                              }
                            }
                            echo '">';
                            echo '<i class="fa fa-check"></i> <span class="hidden-xs">' . strtoupper($lg['lang_id']) . '</span>';
                            echo '</a>';
                            echo '</div>';
                          endforeach;
                        endif;
                        ?>
            </div>
                        <?
                        if (is_array($page['subpages']))
                          echo \admin\view\Pages::subpages_browse_list($page['subpages'], $page['id'], $this->step + 1);
                        ?>
        </li>
          <? endforeach; ?>
  </ol>
    <? endif; ?>