title: Set active class on current page
body: <p>I have this navigation, but I can't seem to find a solution to add an .active class to the current page. Can anyone help me here?</p>
  
  <pre><code>&lt;nav class="menu"&gt;
    &lt;ul class="menu-ul navigation"&gt;
      &lt;div class="menu-first"&gt;
        &lt;li&gt;&lt;a href="index.php"&gt;&lt;span class="main-title"&gt;X-BIKES&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/div&gt;
      &lt;div class="menu-second"&gt;
          &lt;li&gt;&lt;a href="index.php?page=events"&gt;Events&lt;/a&gt;&lt;/li&gt;
          &lt;?php if (empty($_SESSION['user'])): ?&gt;
          &lt;li&gt;&lt;a href="index.php?page=login"&gt;Login&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;/&lt;/li&gt;
          &lt;li&gt;&lt;a href="index.php?page=register"&gt;Register&lt;/a&gt;&lt;/li&gt;
        &lt;?php else: ?&gt;
          &lt;li&gt;&lt;a href="index.php?page=logout"&gt;Logout&lt;/a&gt;&lt;/li&gt;
  
        &lt;li class="menu-cart"&gt;
          &lt;a href="index.php?page=cart"&gt;Cart (&lt;?php
            if(empty($_SESSION['cart'])) {
              echo '0';
            }else {
              echo sizeof($_SESSION['cart']);
            };
        ?&gt;)&lt;/a&gt;
        &lt;/li&gt;
        &lt;?php endif; ?&gt;
      &lt;/div&gt;
    &lt;/ul&gt;
  &lt;/nav&gt;
  </code></pre>