You have to be careful with a query like that. You should be validating that it is more than just set otherwise you could potentially get yourself into SQL injection territories. Adding in an "intval" could help with that just to 100% make the string an integer before being placed in your code.
I've adjusted your code block to also remove the "else" section, because you can easily define it above, and won't run into scoping issues.
$page = 1;
if (isset($_GET["page"]) && ($value = intval($_GET["page"]))) {
$page = $value;
}
$start_from = ($page-1) * $perpage;
The caveat with this code, is it isn't going to do a "0-based", so your pages must start at 1 which is what you are doing anyways with the page - 1 part.