it really depends on your use case ...
if it is mission-critical, then an online ups is the only way to go. however, it is a failure point in and of itself.
if your looking to get over the occasional sag and line noise then a CVT - constant voltage transformer is a good choice. this is what is used in many "line conditioners" you can use them in conjunction with an offline ups, but do not place these after a ups.
for power loss, i find though, in most cases, the use of standby ups that will trip in brownouts are more than capable. most modern electronics can sustain most line noise and the switchover time of standby ups and many small ones include some lightning protection.
i find though that there's no point in putting ups on the cable modem and router because if you lose power locally you also usually lose your cable connection as the equipment down the line uses the same power.. might be worth it if you want to keep your local network up until the standby power kicks in for example.
a note about dirty power, in most cases the power supply used in modern electronics will absorb most dirty power conditions. remember it goes either through a transformer or a switching supply and then filtered. if it's a switching supply many have a very wide voltage range and will handle brownouts pretty well even.
this is also why modified sine wave ups's are fine for most electronics, they simply don't need that pure sign wave to work.
sometimes there are solutions chasing a problem, so just don't get caught up in that is all I am cautioning about.