This work deals with the design and analysis of a controller for a shunt active power filter. The design is based on combined feedforward and feedback actions, the last using repetitive control, and aims at the obtention of a good closed-loop performance in spite of the possible frequency variations that may occur in the electrical network. As these changes affect the performance of the controller, the proposal includes a compensation technique consisting of an adaptive change of the digital controller's sampling time according to the network frequency variation. However, this implies structural changes in the closed-loop system that may destabilize the overall system. Hence, this article is also concerned with closed-loop stability of the resulting system, which is analyzed using a robust control approach through the small gain theorem. Experimental results that indicate good performance of the closed-loop system are provided.