How can developers ensure that all pages, including inactive ones, are displayed correctly in PHP breadcrumb loops?

Issue: Developers can ensure that all pages, including inactive ones, are displayed correctly in PHP breadcrumb loops by checking if the page is active or not before displaying it in the breadcrumb trail. PHP Code Snippet:

<?php
// Check if the page is active or not
$isActive = true; // Set this variable based on the page's status

// Breadcrumb loop
$pages = array(
    array('title' => 'Home', 'url' => '/'),
    array('title' => 'Products', 'url' => '/products/', 'active' => $isActive),
    array('title' => 'Category', 'url' => '/products/category/', 'active' => $isActive),
    array('title' => 'Product Name', 'url' => '/products/category/product-name/', 'active' => $isActive)
);

// Display breadcrumb trail
echo '<ul>';
foreach ($pages as $page) {
    if ($page['active']) {
        echo '<li><a href="' . $page['url'] . '">' . $page['title'] . '</a></li>';
    } else {
        echo '<li>' . $page['title'] . '</li>';
    }
}
echo '</ul>';
?>