Adjusted pastes for trending updates to be more database agnostic

I adjusted the pastes.php to include more database agnostic functionality so that it does not depend on non-standard MySQL-specific SQL statements by changing the trending update portion to update, check for affected rows, and insert if nothing updated. 

This allows Stikked to be more database agnostic, remain optimal, and work with PostgreSQL and other databases.