Fixing Trending API Error

i have made changes in API.php because of Trending error 
i'm also going to made a changes in pastes.php