'php subpage repeating in link

I just implemented mod_auth_openidc authentication on an apache website and noticed that sometimes after sitting on a webpage for a few minutes, then navigating to another page, I get an error Warning: include(home?page=home.php): Failed to open stream: No such file or directory... on line 46. I notice that the link now has a duplicate subpage, https://domainname.com/application-stage/index.php?page=home?page=home. The end of the link should only have ?page=home once. I didn't notice this issue until after implementing mod_auth_openidc authentication, but it could also be possible that I overlooked it until now.

Below is part of the code where the error is occurring from. The <?php include $page.'.php' ?> line of code is line 46. Any ideas of why this is happening? I tried searching online and in this forum, but I wasn't really sure what "keywords" to use, so my results came up short.

<body>
    <?php include 'topbar.php' ?>
    <?php include 'navbar.php' ?>
  <div class="toast" id="alert_toast" role="alert" aria-live="assertive" aria-atomic="true">
    <div class="toast-body text-white">
    </div>
  </div>
  <main id="view-panel" >
      <?php $page = isset($_GET['page']) ? $_GET['page'] :'home'; ?>
    <?php include $page.'.php' ?>
    

  </main>
<nav id="sidebar">
<div class="sidebar-list">

                <a href="index.php?page=home" class="nav-item nav-home"><span class='icon-field'><i class="fa fa-home"></i></span> Home</a>
        </div>
</nav>
<script>
    $('.nav-<?php echo isset($_GET['page']) ? $_GET['page'] : '' ?>').addClass('active')
</script>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source