Avoid division by zero and excessive ranks in pytorctl's ScanHandler.rank_to_percent

This is another possible source of percentile errors in pytorctl.