If I were to look at this question in a more general sense, it's possible that you are in fact accessing / viewing the output of several templates because of embeds.
One of the best ways to determine which templates are being used in a page view is to enable template debugging and look through the list.
http://ellislab.com/expressionengine/user-guide/cp/admin/output_and_debugging_preferences.html
In that list you will see which templates are being loaded (the main template as well as the embeds) and which order they are being loaded in. You will also see a list of tags which are being loaded.
However, in your example, you are really looking at segment variables, which aren't always coupled directly to specific templates. There are lots of methods which may make URL segments unreliable indicators of which templates are being used. For example, the pages module allows for custom URL segments.
In your case, I would typically do something like what Pat Brumfield mentioned. I would create an embedded template for the navigation and then from the main template (the one referencing the embed) I would use a embed variable to indicate which section the site is in.
{embed="includes/sidebar" section="home"}
And then, in the sidebar I would have a conditional which would look something like this.
<li{if embed:section == "home"} class="active"{/if}>Nav Item</li>