<?php
require_once "breadcrumbs_3.3.2/autoload.php";
$breadcrumbs = new Creitive\Breadcrumbs\Breadcrumbs;

$array_urls = $_SESSION['pathDirectory'];

$server = $_SERVER['REQUEST_URI'];
$serverURI = explode('?',$server);
$server = $serverURI[0];

$URI = str_replace('edas_nav_directory_list.php','',$server); // parte de la URL que hay que añadir a las referencias edas_nav_file_list.php
$URI = str_replace('edas_nav_file_list.php','',$URI); // parte de la URL que hay que añadir a las referencias

for ($x = 0; $x < count($array_urls); $x++) {
    $id = $array_urls[$x]['id'];
    if ($id <> NULL) { // First directory not has files
        $rs = DB::Query("SELECT count(*) counter FROM edas_file WHERE edas_directory_id = $id");
        $counter =  $rs->value("counter");
    }
    if ($x == 0) {
        $breadcrumbs->addCrumb('<span class="glyphicon glyphicon-home"></span>', $URI.$array_urls[$x]['url']);
    } else {
        $breadcrumbs->addCrumb($array_urls[$x]['code']."<b> ($counter)</b>", $URI.$array_urls[$x]['url']);
    }
}

// $breadcrumbs->addCrumb('<img src="/images/foo.png">', '/foo');
// $breadcrumbs->addCrumb(htmlspecialchars($userSubmittedName), 'bar');

$breadcrumbs->setDivider('');
$breadcrumbs->setListElement('ol');
$breadcrumbs->setCssClasses("breadcrumb");
$breadcrumbs->setLastItemWithHref(false);

echo $breadcrumbs->render();