Rank was defined in the first query (so my resolution, utilizes the first query to determine the current players rank and then a second query to get the others).
Your concern for the less than 50 is valid, so I'll adjust my php to handle that scenario
$limitStart = ($rank >= 50) ? $rank - 50 : 0;
$limitNumber = ($rank >= 50) ? 100 : 100 - $rank;
$sql = mysql_query("SELECT * FROM ".$prefix."_users WHERE played > 0 AND id != $playerid ORDER BY points LIMIT ".$limitStart.", ".$limitEnd) or die(mysql_error());
Okay, now to explain the calculations for $limitStart and $limitEnd
If $rank is greater than or equal to 50 (again, change to 50 to 51 if the results show it should be), subtract 50/51 from the $rank to get your start position.
If the current player's rank is less than 50, start at 0 (although I think starting at a negative number is valid).
If $rank is greater than or equal to 50, use 100, as that should give you 50 prior and 50 after (assuming there are at least 100 players).
If the current player's rank is less than 50, subtract the current player's rank from 100, so that you end up with 50 after the player's rank and the X number prior to his rank.
For example, if the players rank is 27, you would perform 100 - 27, which is 73. So you would start at 0, and get the next 73 records. 27 of those were ranked ahead of the current player, the other 50 are after his rank.