<?php

function getProgressBar($total, $limit) {
    
    $total = ($total == 0 ? 1 : intval($total));
    $limit = ($limit == 0 ? 1 : intval($limit));

    if ($limit > 4) {
        return str_replace(',', '.', ($total / $limit) * 100);
    } else {
       return intval(($total / $limit) * 100);
    }
}   

function breadcrumbs($sep = '', $home = 'Dashboard')
{
    
    $site = 'https://'.$_SERVER['HTTP_HOST'].DIRECTORY_SEPARATOR.'painel_beta';
    $crumbs = explode('/', strrev($_SERVER["REQUEST_URI"]), 4);
    //var_dump(parse_url($_SERVER["REQUEST_URI"])); exit;
    $homeurl = $site;
    $page = strrev($crumbs[1]);
   
    $link1 = ucfirst(str_replace( array(".php","-","_"), array(""," "," ") , strrev($crumbs[2])));
    $link = ucfirst(str_replace( array(".php","-","_"), array(""," "," ") ,$page));
    $bc = '<ol class="breadcrumb">';
    $bc .= '<li><a href="'.$homeurl.'">'.$home.'</a>'.$sep.'</li>';
    //var_dump($homeurl);// exit; 
    //var_dump($link); //exit; 
    // if($link == "Dashboard")
    // {
    //     $bc .= '<li class="active">Dashboard</li>';
    // }
    // elseif($link == "Index2")
    // {
    //     $bc .= '<li class="active">Demographical</li>';
    // }
    // elseif($link == "Index3")
    // {
    //     $bc .= '<li class="active">Analitical</li>';
    // }
    // elseif($link == "Index4")
    // {
    //     $bc .= '<li class="active">Simpler</li>';
    // }
    // else
    // {
    $link1 = (strlen($link1) > 0) ? "<a>$link1 /</a>": '';
    
        $bc .= '<li class="text-muted">'.$link1.'<span class="active">  '.$link.' </span></li>'; 
    //}
$bc .= '</ol>';
return $bc;
}
?>