Change the looping structure of index.php