<div><table class="table table-hover">
<?php

require_once("includes/config.php");
require_once("includes/global.php");



$theme="v1";
if(isset($_GET['page'])&& $_GET['page']>1){
$page=(int)$_GET['page'];
$offset=(50*($page-1))+1;
}else{
$page=1;
$offset=1;
}
$onlinelist = getOnlineList(1,$offset);
$prev=max($page-1,1);
$next=$page+1;
$page1=$page-2;
$page2=$page+2;
echo '<nav aria-label="Page navigation example">
  <ul class="pagination">
    <li class="page-item"><a class="page-link" href="?p=online&page='.$prev.'">Previous</a></li>';
if($page==1){
    echo '<li class="page-item active"><a class="page-link" href="#">'.$page.'</a></li>
    <li class="page-item"><a class="page-link" href="?p=online&page='.$next.'">'.$next.'</a></li>
    <li class="page-item"><a class="page-link" href="?p=online&page='.$page2.'">'.$page2.'</a></li>';
}elseif($page==2){
    echo '<li class="page-item"><a class="page-link" href="?p=online&page='.$prev.'">'.$prev.'</a></li>
	<li class="page-item active"><a class="page-link" href="#">'.$page.'</a></li>
    <li class="page-item"><a class="page-link" href="?p=online&page='.$next.'">'.$next.'</a></li>
    <li class="page-item"><a class="page-link" href="?p=online&page='.$page2.'">'.$page2.'</a></li>';	
}else{
    echo '<li class="page-item"><a class="page-link" href="?p=online&page='.$page1.'">'.$page1.'</a></li>
	<li class="page-item"><a class="page-link" href="?p=online&page='.$prev.'">'.$prev.'</a></li>
	<li class="page-item active"><a class="page-link" href="#">'.$page.'</a></li>
    <li class="page-item"><a class="page-link" href="?p=online&page='.$next.'">'.$next.'</a></li>
    <li class="page-item"><a class="page-link" href="?p=online&page='.$page2.'">'.$page2.'</a></li>';	
}
echo '<li class="page-item"><a class="page-link" href="?p=online&page='.$next.'">Next</a></li>
  </ul>
</nav>';


if($onlinelist == 'empty'){ 
}
else{
	foreach($onlinelist as $online) {
		if($online['gmlevel'] > 2){ 
		}
		else{
			$link="";
			$linkshell=getLinkshell($online['linkshellid1']);
			if($linkshell=='empty'){
				$rgb=0;
				$cwstatus=getPlayerByVariable($online['charid'],'[CW]STATUS');
if($cwstatus==1){
echo '<tr><td><img src="theme/v1/images/cw/cw.png" height="25" width="25" alt="CW" title="Crystal Warrior"></td><td>';
}
elseif($cwstatus==2){
echo '<tr><td><img src="theme/v1/images/cw/ucw.png" height="25" width="25" alt="UCW" title="Unbreakable Crystal Warrior"></td><td>';
			}else{
				echo '<tr><td><i class="fas bi-person-badge" style="font-size: 2rem;"></i></td><td>';
			}
			}
			else{
				$color=dechex($linkshell['color']);
				$rgb = hex2rgb($color);
				if($rgb=='empty'){
				}
				else{
$cwstatus=getPlayerByVariable($online['charid'],'[CW]STATUS');
if($cwstatus==1){
echo '<tr><td><img src="theme/v1/images/cw/cw.png" height="25" width="25" alt="CW" title="Crystal Warrior"></td><td>';
}
elseif($cwstatus==2){
echo '<tr><td><img src="theme/v1/images/cw/ucw.png" height="25" width="25" alt="UCW" title="Unbreakable Crystal Warrior"></td><td>';
}
else{
	
					echo '<tr><td><i class="fas bi-person-badge" style="font-size: 2rem;"></i></td><td>';
}
					echo '<div style="width: 25px; height: 25px; background-color:rgba('.$rgb[0].','.$rgb[1].','.$rgb[2].',1)">';
					if($online['linkshellrank1']==1){
						echo '<img src="theme/'.$theme.'/images/shell.png" height="25" width="25" alt="'.$linkshell['name'].'" title="'.$linkshell['name'].'"></div>';
					}
					elseif($online['linkshellrank1']==2){
						echo '<img src="theme/'.$theme.'/images/sack.png" height="25" width="25" alt="'.$linkshell['name'].'" title="'.$linkshell['name'].'"></div>';
					}
					elseif($online['linkshellrank1']==3){
						echo '<img src="theme/'.$theme.'/images/pearl.png" height="25" width="25" alt="'.$linkshell['name'].'" title="'.$linkshell['name'].'"></div>';
					}
					else{
						echo '</div>';
					}
				}
			}
				$link="";
				$linkshell=getLinkshell($online['linkshellid2']);
				if($linkshell=='empty'){
					$rgb=0;
					echo '';
				}
				else{
					$color=dechex($linkshell['color']);
					$rgb = hex2rgb($color);
					if($rgb=='empty'){
					}
					else{
						echo '<div style="width: 25px; height: 25px; background-color:rgba('.$rgb[0].','.$rgb[1].','.$rgb[2].',1)">';
						if($online['linkshellrank2']==1){
							echo '<img src="theme/'.$theme.'/images/shell.png" height="25" width="25" alt="'.$linkshell['name'].'" title="'.$linkshell['name'].'"></div>';
						}
						elseif($online['linkshellrank2']==2){
							echo '<img src="theme/'.$theme.'/images/sack.png" height="25" width="25" alt="'.$linkshell['name'].'" title="'.$linkshell['name'].'"></div>';
						}
						elseif($online['linkshellrank2']==3){
							echo '<img src="theme/'.$theme.'/images/pearl.png" height="25" width="25" alt="'.$linkshell['name'].'" title="'.$linkshell['name'].'"></div>';
						}
						else{
							echo '<img src="theme/'.$theme.'/images/pearl.png" height="25" width="25" alt="'.$linkshell['name'].'" title="'.$linkshell['name'].'"></div>';
						}
					}
				}
			echo '</td><td><a href="?p=characters&id='.$online['charid'].'">'.$online['charname'].'</a><br>'.$online['mlvl'].strtoupper($jobs[$online['mjob']]).(!empty($online['sjob']) ? '/'.$online['slvl'].strtoupper($jobs[$online['sjob']]) : '').'</td><td></td></tr>';
		}
	}
}
?>
</table></div>